mruby-bigint (uzero_p): check from the top, not bottom

For most of the case, the first non-zero value would be found earlier
when search starts from the top.
This commit is contained in:
Yukihiro "Matz" Matsumoto
2024-10-01 08:54:26 +09:00
parent fcc1832efc
commit 363754b5d1
+1 -1
View File
@@ -249,7 +249,7 @@ static int
uzero_p(mpz_t *x)
{
if (x->sz == 0) return 1;
for (size_t i=0; i < x->sz; i++)
for (size_t i=x->sz-1; 0 <= i; i--)
if (x->p[i] != 0)
return 0;
return 1;