Versions Compared

Key

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

...

A portable (and safer) way to set all the bits on in an integer constant of type unsigned long is to define a constant with a value of ~0a complement of 0 (defined to be the appropriate type).

Code Block
bgColor#CCCCFF
const unsigned long mask = ~0~0UL;
unsigned long x;

/* Initialize x */

x = (x ^ mask) + 1;

...