Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0

...

In this compliant solution, the integer constant -1 is used to set all bits in mask to one. The integer constant -1 is of type signed int. Because -1 cannot be represented by a variable of type unsigned long, it is converted to a representable number according to the rule in Section 6.3.1.3, Paragraph 2 of the C99 standard,

Wiki Markup\[If the value can't be represented by the new type and\] if the new type is unsigned, the value is converted by repeatedly adding or subtracting one more than the maximum value that can be represented in the new type until the value is in the range of the new type.

"One more than the maximum value that can be represented in the new type," ULONG_MAX + 1, is added to -1, resulting in a right-hand-side value of ULONG_MAX. The representation of ULONG_MAX is guaranteed to have all bits set to one by Section 6.2.6.2, Paragraph 1,

...

ISO/IEC 9899-1999 Section 6.4.4.1, "Integer constants"

Bibliography

...

\[[Dewhurst 2002|AA. Bibliography#Dewhurst 02]\] Gotcha #25, "#define Literals"

...

      04. Integers (INT)