previous | start | next

Another Example

Example 1 What is the 4 byte representation of the int -5 in memory (in hex)? - 37

      y = 5 = 0x5 = 0x00000005

          y = 0x00000005      
         ~y = 0xFFFFFFFA
                      +1
              ----------
-y = ~y + 1 = 0xFFFFFFFB

    Answer: 4 byte representation of -5 is 0xFFFFFFFB
   

Example 2 4 byte representation of -37?

      y = 42 = (32 = 10) = 0x2A = 0x0000002A

           y = 0x0000002A
          ~y = 0xFFFFFFD5
                       +1
               ----------
-y = ~y + 1 =  0xFFFFFFD6
   


previous | start | next