Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
bgColor#FFCCCC
#define MASK   0xFFFFFFFFL
...
long x = -1L;

/* should not do bitwise operations on signed numbers*/
unsigned long u_x = (unsigned long) x;
unsigned long positive_u_x = (u_x ^ MASK) + 1;

long positive_x = (signed long) positive_u_x;

...

Code Block
bgColor#CCCCFF
#define MASK   ~0
...
long x = -1L;

/* should not do bitwise operations on signed numbers*/
unsigned long u_x = (unsigned long) x;
unsigned long positive_u_x = (u_x ^ MASK) + 1;

long positive_x = (signed long) positive_u_x;

...