From 93653dfd4c6fbf5809487eefee7e0236cf79d762 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Thu, 25 Jul 2024 15:41:24 +0900 Subject: [PATCH] mruby-bigint (uzero_p): add fast path --- mrbgems/mruby-bigint/core/bigint.c | 1 + 1 file changed, 1 insertion(+) diff --git a/mrbgems/mruby-bigint/core/bigint.c b/mrbgems/mruby-bigint/core/bigint.c index 47ac58f4d..c4fae753a 100644 --- a/mrbgems/mruby-bigint/core/bigint.c +++ b/mrbgems/mruby-bigint/core/bigint.c @@ -248,6 +248,7 @@ ucmp(mpz_t *y, mpz_t *x) static int uzero_p(mpz_t *x) { + if (x->sz == 0) return 1; for (size_t i=0; i < x->sz; i++) if (x->p[i] != 0) return 0;