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 #9732
  • Loading branch information
Ubuntu authored and tonyhutter committed Jan 22, 2020
1 parent 363d733 commit 603ae6a
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 603ae6a

Please sign in to comment.