2.82 Signed and Unsigned
★
/* Create some arbitrary values */
int x = random();
int y = random();
/* Convert to unsigned */
unsigned ux = (unsigned) x;
unsigned uy = (unsigned) y;((x+y) << 4) + y-x
= 16*x + 16*y +y -x
= 17*7 + 15*xLast updated
★
/* Create some arbitrary values */
int x = random();
int y = random();
/* Convert to unsigned */
unsigned ux = (unsigned) x;
unsigned uy = (unsigned) y;((x+y) << 4) + y-x
= 16*x + 16*y +y -x
= 17*7 + 15*xLast updated
~x+~y+1
= ~x+1 + ~y+1 -1
=-x + -y - 1
= -(x+y) - 1
= ~(x+y)