mirror of
https://github.com/BinomialLLC/basis_universal.git
synced 2026-09-04 01:18:18 +00:00
Fixed signed integer overflow
(1 << num_bits) was converted to a signed integer that caused an overflow (as num_bits was usually set to 31). It worked fine since the value was later converted back to uint32_t but signed integer overflow is technically an undefined behavior and it was triggering errors in our automated tests.
This commit is contained in:
@@ -3814,7 +3814,7 @@ namespace basist
|
||||
assert(num_bits < 32);
|
||||
assert(val < (1ULL << num_bits));
|
||||
|
||||
uint32_t mask = (1 << num_bits) - 1;
|
||||
uint32_t mask = (1ULL << num_bits) - 1;
|
||||
|
||||
while (num_bits)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user