| author | |
| committer | |
| log | efa39c5343e13a13e65210f55da5df23ee3feb3e |
| tree | 5bf359499baa56f4066165c135e382d3a9bb1f1e |
| parent | c3ddf5069e0fb0b728ce275410988ccec3ab7ce9 |
2 files changed, 9 insertions(+), 1 deletions(-)
src/bigint.cpp+1-1| ... | ... | @@ -1425,7 +1425,7 @@ void bigint_shr(BigInt *dest, const BigInt *op1, const BigInt *op2) { |
| 1425 | 1425 | uint64_t digit = op1_digits[op_digit_index]; |
| 1426 | 1426 | size_t dest_digit_index = op_digit_index - digit_shift_count; |
| 1427 | 1427 | dest->data.digits[dest_digit_index] = carry | (digit >> leftover_shift_count); |
| 1428 | carry = digit << leftover_shift_count; | |
| 1428 | carry = digit << (64 - leftover_shift_count); | |
| 1429 | 1429 | |
| 1430 | 1430 | if (dest_digit_index == 0) { break; } |
| 1431 | 1431 | op_digit_index -= 1; |
test/cases/math.zig+8| ... | ... | @@ -366,6 +366,14 @@ test "big number multi-limb shift and mask" { |
| 366 | 366 | } |
| 367 | 367 | } |
| 368 | 368 | |
| 369 | test "big number multi-limb partial shift right" { | |
| 370 | comptime { | |
| 371 | var a = 0x1ffffffffeeeeeeee; | |
| 372 | a >>= 16; | |
| 373 | assert(a == 0x1ffffffffeeee); | |
| 374 | } | |
| 375 | } | |
| 376 | ||
| 369 | 377 | test "xor" { |
| 370 | 378 | test_xor(); |
| 371 | 379 | comptime test_xor(); |