cppcheck: (error) Shifting signed 64-bit value by 63 bits
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
This commit is contained in:
parent
7cf1fe6331
commit
abfdb83607
|
@ -275,7 +275,9 @@ int64_t
|
||||||
__divdi3(int64_t u, int64_t v)
|
__divdi3(int64_t u, int64_t v)
|
||||||
{
|
{
|
||||||
int64_t q, t;
|
int64_t q, t;
|
||||||
|
// cppcheck-suppress shiftTooManyBitsSigned
|
||||||
q = __udivdi3(abs64(u), abs64(v));
|
q = __udivdi3(abs64(u), abs64(v));
|
||||||
|
// cppcheck-suppress shiftTooManyBitsSigned
|
||||||
t = (u ^ v) >> 63; // If u, v have different
|
t = (u ^ v) >> 63; // If u, v have different
|
||||||
return ((q ^ t) - t); // signs, negate q.
|
return ((q ^ t) - t); // signs, negate q.
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue