aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFrank Denis <github@pureftpd.org>2021-01-31 20:58:11 +0100
committerAndrew Kelley <andrew@ziglang.org>2021-02-01 12:10:01 -0800
commita03f9548d3dd32876f99f5b7bdf1d678c5a5b98e (patch)
tree157e2951f458d9f63c7e9cda2789f19b2dea36b0 /src
parentbf76501b5d46277d3706a1f0b92ba52f2a47d894 (diff)
downloadzig-a03f9548d3dd32876f99f5b7bdf1d678c5a5b98e.tar.gz
zig-a03f9548d3dd32876f99f5b7bdf1d678c5a5b98e.zip
std/math/big/int: normalize after a right shift
After a right shift, top limbs may be all zero. However, without normalization, the number of limbs is not going to change. In order to check if a big number is zero, we used to assume that the number of limbs is 1. Which may not be the case after right shifts, even if the actual value is zero. - Normalize after a right shift - Add a test for that issue - Check all the limbs in `eqlZero()`. It may not be necessary if callers always remember to normalize before calling the function. But checking all the limbs is very cheap and makes the function less bug-prone.
Diffstat (limited to 'src')
0 files changed, 0 insertions, 0 deletions