diff options
| author | gingerBill <bill@gingerbill.org> | 2018-07-28 18:36:45 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2018-07-28 18:36:45 +0100 |
| commit | 8504ff920b057007382bbeefcaa8a40e35689526 (patch) | |
| tree | ad2e9416ff6fc6a51534e45328b543109e50026d /src/exact_value.cpp | |
| parent | e34a9e61857a2786abb031d553d4def419f2838c (diff) | |
Correctly handle bitwise operations for negative BigInt
Diffstat (limited to 'src/exact_value.cpp')
| -rw-r--r-- | src/exact_value.cpp | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/src/exact_value.cpp b/src/exact_value.cpp index a49a8645f..e339e876b 100644 --- a/src/exact_value.cpp +++ b/src/exact_value.cpp @@ -523,21 +523,13 @@ ExactValue exact_binary_operator_value(TokenKind op, ExactValue x, ExactValue y) case Token_Quo: return exact_value_float(fmod(big_int_to_f64(a), big_int_to_f64(b))); case Token_QuoEq: big_int_quo(&c, a, b); break; // NOTE(bill): Integer division case Token_Mod: big_int_rem(&c, a, b); break; - case Token_ModMod: - big_int_rem(&c, a, b); - big_int_add_eq(&c, b); - big_int_rem_eq(&c, b); - break; + case Token_ModMod: big_int_euclidean_mod(&c, a, b); break; case Token_And: big_int_and(&c, a, b); break; case Token_Or: big_int_or(&c, a, b); break; case Token_Xor: big_int_xor(&c, a, b); break; case Token_AndNot: big_int_and_not(&c, a, b); break; - case Token_Shl: - big_int_shl(&c, a, b); - break; - case Token_Shr: - big_int_shr(&c, a, b); - break; + case Token_Shl: big_int_shl(&c, a, b); break; + case Token_Shr: big_int_shr(&c, a, b); break; default: goto error; } |