...
The typedef name uintN_t designates an unsigned integer type with width N. Consequently, uint32_t denotes an unsigned integer type with a width of exactly 32 bits. Bitmaps should be declared as unsigned. See guidline recommendation INT13-C. Use bitwise operators only on unsigned operands.
...
Although this code is likely to perform the division correctly, it is not guaranteed to. If x has a signed type and a negative value, the operation is implementation defined and can be implemented as either an arithmetic shift or a logical shift. In the event of a logical shift, if the integer is represented in either one's complement or two's complement form, the most significant bit (which controls the sign for both representations) will be set to zero. This will cause a once negative number to become a possibly very large, positive number. For more details, see guideline recommendation INT13-C. Use bitwise operators only on unsigned operands.
...
Search for vulnerabilities resulting from the violation of this rule on the CERT website.
Related Guidelines
CERT C++ Secure Coding Standard: INT14-CPP. Avoid performing bitwise and arithmetic operations on the same data
...
\[[ISO/IEC 9899:1999|AA. Bibliography#ISO/IEC 9899-1999]\] Section 6.2.6.2, "Integer types"
\[[Wiki Markup
ISO/IEC PDTR 24772|AA. Bibliography#ISO/IEC PDTR 24772]\] TR 24772 "STR Bit Representations" \[[MISRA 2004|AA. Bibliography#MISRA 04]\] Rules
MISRA Rules 6.4 and 6.5
Bibliography
| Wiki Markup |
|---|
\[[Steele 1977|AA. Bibliography#Steele 77]\] |
...