[prev] 48 [next]

Unsigned integers (cont)

Value interpreted as binary number

E.g. consider an 8-bit unsigned int

01001101  =  26 + 23 + 22 + 20  =  64 + 8 + 4 + 1  =  77

Addition is bitwise with carry

  00000001     00000001     01001101     11111111
+ 00000010   + 00000011   + 00001011   + 00000001
  --------     --------     --------     --------
  00000011     00000100     01011000     00000000

Most machines will also flag the overflow in the fourth example