Skip to content

Commit

Permalink
cppcheck: (error) Shifting signed 64-bit value by 63 bits
Browse files Browse the repository at this point in the history
As of cppcheck 1.82 surpress the warning regarding shifting too many
bits for __divdi3() implemention.  The algorithm used here is correct.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes openzfs#9732
  • Loading branch information
Ubuntu authored and tonyhutter committed Dec 26, 2019
1 parent 8d844da commit 0ff1481
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions module/spl/spl-generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,9 @@ int64_t
__divdi3(int64_t u, int64_t v)
{
int64_t q, t;
// cppcheck-suppress shiftTooManyBitsSigned
q = __udivdi3(abs64(u), abs64(v));
// cppcheck-suppress shiftTooManyBitsSigned
t = (u ^ v) >> 63; // If u, v have different
return ((q ^ t) - t); // signs, negate q.
}
Expand Down

0 comments on commit 0ff1481

Please sign in to comment.