Search code examples
hexmsdndomaindatasource

Hex annotation on MSDN site


I fail to understand the hex annotation at the MSDN site

On the following MSDN site: DDS file spec

there is a table at dwFlags. dwFlags is a DWORD (4 Bytes or 0x00000000)

Question: The hex annotations for a value (e.g.) 0x800000 are confusing me, which bit (of the 32) do I have to flip?

Please 'translate' the value coloumn of the source (just 8 values)


Solution

  • 0x800000 is the same as 100000000000000000000000 in binary.

     1000 0000 0000 0000 0000 0000
     ^  ^    ...       ^    ^    ^
    23 20    ...       8    4    0   = bit position
    

    So it's the 23rd bit.

    For dwFlags does this mean:

    0x1      = 1
    0x2      = 10
    0x4      = 100
    0x8      = 1000
    0x1000   = 1000000000000
    0x20000  = 100000000000000000
    0x80000  = 10000000000000000000
    0x800000 = 100000000000000000000000