py/objfloat: Fix undefined integer behavior hashing negative zero.
Under ubsan, when evaluating hash(-0.) the following diagnostic occurs: ../../py/objfloat.c:102:15: runtime error: negation of -9223372036854775808 cannot be represented in type 'mp_int_t' (aka 'long'); cast to an unsigned type to negate this value to itself So do just that, to tell the compiler that we want to perform this operation using modulo arithmetic rules.
This commit is contained in:
parent
c4dafcef4f
commit
95e43efc99
@ -99,7 +99,7 @@ typedef uint32_t mp_float_uint_t;
|
||||
}
|
||||
|
||||
if (u.p.sgn) {
|
||||
val = -val;
|
||||
val = -(mp_uint_t)val;
|
||||
}
|
||||
|
||||
return val;
|
||||
|
Loading…
Reference in New Issue
Block a user