...
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 | ||
|---|---|---|
| ||
unsigned int a, b; unsigned long c; /* ... */ c = (unsigned long)a * b; /* not guaranteed to fit */ |
...