aboutsummaryrefslogtreecommitdiff
path: root/src/value.zig
diff options
context:
space:
mode:
authorIntegratedQuantum <43880493+IntegratedQuantum@users.noreply.github.com>2022-12-14 01:29:25 +0100
committerGitHub <noreply@github.com>2022-12-14 00:29:25 +0000
commit0b4461d97b5d315e71302f96076c54bbdffb7717 (patch)
tree1c52ec832285d2234c7a423b46327b56da0d3cc0 /src/value.zig
parentf1b536c44c2854b33a1541624711e006748469a3 (diff)
downloadzig-0b4461d97b5d315e71302f96076c54bbdffb7717.tar.gz
zig-0b4461d97b5d315e71302f96076c54bbdffb7717.zip
Fix tautological big_int tests.
Diffstat (limited to 'src/value.zig')
-rw-r--r--src/value.zig8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/value.zig b/src/value.zig
index f37fec13bb..3d5636ee34 100644
--- a/src/value.zig
+++ b/src/value.zig
@@ -4194,8 +4194,12 @@ pub const Value = extern union {
const result_limbs = lhs_bigint.limbs.len -| (shift / (@sizeOf(std.math.big.Limb) * 8));
if (result_limbs == 0) {
// The shift is enough to remove all the bits from the number, which means the
- // result is zero.
- return Value.zero;
+ // result is 0 or -1 depending on the sign.
+ if (lhs_bigint.positive) {
+ return Value.zero;
+ } else {
+ return Value.negative_one;
+ }
}
const limbs = try allocator.alloc(