From 55e040958279627abb06e20b1993a2165e64d13b Mon Sep 17 00:00:00 2001 From: dzaima Date: Wed, 24 May 2023 15:13:25 +0300 Subject: [PATCH] don't CTZ(0) in gcd --- src/builtins/arithd.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/builtins/arithd.c b/src/builtins/arithd.c index 9a27f367..9ee7d4ff 100644 --- a/src/builtins/arithd.c +++ b/src/builtins/arithd.c @@ -484,12 +484,13 @@ static u64 gcd_u64(u64 a, u64 b) { u8 sh = az>= bz; - while (a > 0) { + while (1) { a >>= az; u64 d = b - a; - az = CTZ(d); b = b