mrjbom wrote:
Now I have to translate the value from 16 to 2 number system and manually examine the bits by checking the documentation.
Well, if you are doing that, you are already doing something wrong (unless I misunderstood you). You see, each hex digit is a shorthand for four bits. This makes it both easy to identify what bits a given hex digit stands for (as it is always the same thing), and to locate the bit in the documentation.
For example, I'm defining the GDT as just an array of 64-bit numbers. So I have the assignment
Code:
gdt[KCODE_DESC] = 0x00af9a000000ffff;
Cross-reference that with the documentation for a 64-bit GDT entry, and you see, for example, that the first "a" in the number means that the G bit and the L bit are set: "a" is "1010" in binary, and this one is two digits in, so eight bits in. And luckily in the GDT entry, most important things line up with boundaries divisible by four.
Doesn't always work that way, but then you just get as close as possible with hex digits. And so there is never really a reason to translate the number back to binary. One thing I particularly never understood is the insistence of some members of this community to use binary for full thirty-two bit numbers (or even sixty-four bit numbers). How do you even see anything in that long mess?