Versions Compared

Key

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

...

The intent of the expression in this noncompliant code example is to add the variable OFFSET to the result of the bitwise logical AND between x and MASK.:

Code Block
bgColor#FFCCCC
public static final int MASK = 1337;
public static final int OFFSET = -1337;

public static int computeCode(int x) {
  return x & MASK + OFFSET;
}

...

By mathematical convention, multiplication is performed before addition; parentheses are redundant in this case.:

Code Block
bgColor#FFCCCC
x + (y * z)

...