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;
}

...

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="73385d2bfe6b95a2-87d6fe8d-43db4dd9-9f6b85be-d16734a77e5cbe88cc8fd26f"><ac:plain-text-body><![CDATA[

[[ESA 2005

AA. References#ESA 05]]

Rule 65: Use parentheses to explicitly indicate the order of execution of numerical operators

]]></ac:plain-text-body></ac:structured-macro>

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="b068d297faddc757-ea82f976-4f3d45b0-8d049fe6-ed20c4bd1fc6a097fc92a922"><ac:plain-text-body><![CDATA[

[[Tutorials 2008

AA. References#Tutorials 08]]

[Expressions, Statements, and Blocks

http://java.sun.com/docs/books/tutorial/java/nutsandbolts/expressions.html]

]]></ac:plain-text-body></ac:structured-macro>

 

Operators

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="a85631921c225a69-9e8fcc7b-495c4cd2-9adcb1ee-8b3f1eb3737ab4059a3f9cde"><ac:plain-text-body><![CDATA[

[[Rogue 2000

AA. References#Rogue 2000]]

Rule 77: Clarify the order of operations with parentheses

]]></ac:plain-text-body></ac:structured-macro>

...