previous | start | next

Signed Integer value of 4 byte Hex Representation

If the signed integer x has the 4 byte hex representation:

      0xFFFFF5F8
   

What is the value of x?

Answer. This x is negative (sign bit is 1). So the trick is to compute the negative of x: -x = ~x + 1

          x = 0xFFFFF5F8
         ~x = 0x00000A07
                      +1
              ----------
-x = ~x + 1 = 0x00000A08 = 10 * 256 + 0 * 16 + 8 * 1 = 2568

   

So the answer is

      x = -2568
   


previous | start | next