Skip to content

Commit a99a6f7

Browse files
Apply suggestions from code review
Co-Authored-By: Felicity Chapman <felicitymay@github.com>
1 parent 4cb28d9 commit a99a6f7

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

java/ql/src/Likely Bugs/Arithmetic/LShiftLargerThanTypeWidth.qhelp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,21 @@ lowest 6 bits when the type is <code>long</code>.
1414
<recommendation>
1515

1616
<p>
17-
Restrict the shift amount of <code>int</code>s to the range 0-31, or cast to <code>long</code> before left-shifting.
17+
Restrict the amount that you shift any <code>int</code> to the range 0-31, or cast it to <code>long</code> before applying the left shift.
1818
</p>
1919

2020
</recommendation>
2121
<example>
2222
<p>
23-
The following line tries to left-shift an <code>int</code> 32 bits.
23+
The following line tries to left-shift an <code>int</code> by 32 bits.
2424
</p>
2525

2626
<sample src="LShiftLargerThanTypeWidth.java" />
2727

2828
<p>
29-
However, left-shifting an <code>int</code> 32 bits is equivalent to
30-
left-shifting 0 bits, that is, not shifting at all. Instead the value should
31-
be cast to <code>long</code> before shifting to actually left-shift 32 bits.
29+
However, left-shifting an <code>int</code> by 32 bits is equivalent to
30+
left-shifting it by 0 bits, that is, no shift is applied. Instead the value should
31+
be cast to <code>long</code> before the shift is applied. Then the left-shift of 32 bits will work.
3232
</p>
3333

3434
<sample src="LShiftLargerThanTypeWidthGood.java" />

0 commit comments

Comments
 (0)