Versions Compared

Key

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

...

This non-compliant code attempts to guarantee that all bits of a multiplication of two unsigned int values are retained by performing arithmetic in the type unsigned long.   This works for some machines (eg , such as 64-bit Linux), but fails for others (eg Win64), such as 64-bit Microsoft Windows.

Code Block
bgColor#FFcccc
unsigned int a, b;
unsigned long c;
/* ... */
c = (unsigned long)a * b; /* not guaranteed to fit */

...