big: Add randomized testing.

This commit is contained in:
Jeroen van Rijn
2021-08-11 20:59:52 +02:00
parent 13fab36639
commit c1a001c331
4 changed files with 81 additions and 23 deletions
+1 -1
View File
@@ -402,7 +402,7 @@ int_shl :: proc(dest, src: ^Int, bits: int) -> (err: Error) {
shift := DIGIT(_DIGIT_BITS - bits);
carry := DIGIT(0);
for x:= 0; x <= dest.used; x+= 1 {
for x:= 0; x < dest.used; x+= 1 {
fwd_carry := (dest.digit[x] >> shift) & mask;
dest.digit[x] = (dest.digit[x] << uint(bits) | carry) & _MASK;
carry = fwd_carry;