From 476d0087c8d47102c23cf6de71eb4014b9a7b6b2 Mon Sep 17 00:00:00 2001 From: Jeroen van Rijn Date: Sat, 29 Jun 2024 23:14:12 +0200 Subject: [PATCH] Fix bug in div3 fast path. --- core/math/big/private.odin | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/math/big/private.odin b/core/math/big/private.odin index 220f39871..bb6b9497c 100644 --- a/core/math/big/private.odin +++ b/core/math/big/private.odin @@ -975,7 +975,7 @@ _private_int_div_3 :: proc(quotient, numerator: ^Int, allocator := context.alloc q.sign = numerator.sign w, t: _WORD - #no_bounds_check for ix := numerator.used; ix >= 0; ix -= 1 { + #no_bounds_check for ix := numerator.used - 1; ix >= 0; ix -= 1 { w = (w << _WORD(_DIGIT_BITS)) | _WORD(numerator.digit[ix]) if w >= 3 { /*