aboutsummaryrefslogtreecommitdiff
path: root/core/math/big
diff options
context:
space:
mode:
Diffstat (limited to 'core/math/big')
-rw-r--r--core/math/big/internal.odin5
1 files changed, 5 insertions, 0 deletions
diff --git a/core/math/big/internal.odin b/core/math/big/internal.odin
index abe592f9b..70914228e 100644
--- a/core/math/big/internal.odin
+++ b/core/math/big/internal.odin
@@ -2332,7 +2332,12 @@ internal_int_get :: proc(a: ^Int, $T: typeid) -> (res: T, err: Error) where intr
if a.sign == .Zero_or_Positive {
target_bit_size -= 1
}
+ } else {
+ if a.sign == .Negative {
+ return 0, .Integer_Underflow
+ }
}
+
bits_used := internal_count_bits(a)
if bits_used > target_bit_size {