...
Code Block | ||
---|---|---|
| ||
byte[] b = new byte[] {-1, -1, -1, -1}; int result = 0; for (int i = 0; i < 4; i++) { result = ((result << 8) | (b[i] & 0xff)); } |
Exceptions
NUM02NUM01-EX1: Bitwise operations may be used to construct constant expressions. Nevertheless, as a matter of style, we recommend replacing such constant expressions with the equivalent hexadecimal constants 0x1FFFF, in this case.
Code Block | ||
---|---|---|
| ||
int limit = 1 << 17 - 1; // 2^17 - 1 = 131071 |
NUM02NUM01-EX2: Data that is normally treated arithmetically may be treated with bitwise operations for the purpose of serialization or deserialization. This is often required for reading or writing the data from a file or network socket. Bitwise operations are also permitted when reading or writing the data from a tightly packed data structure of bytes.
...
Recommendation | Severity | Likelihood | Remediation Cost | Priority | Level |
---|---|---|---|---|---|
NUM02 NUM01-J | medium | unlikely | medium | P4 | L3 |
...
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="7648c60d3ef0fdd6-8fd67687-4e6e4f9e-b564ac22-b846f620b79f9bc57f4c394f"><ac:plain-text-body><![CDATA[ | [[Steele 1977 | AA. Bibliography#Steele 1977]] | ]]></ac:plain-text-body></ac:structured-macro> |
...