mruby-bigint (uzero_p): avoid signed and unsigned comparison in loop

This commit is contained in:
Yukihiro "Matz" Matsumoto
2024-10-16 15:06:53 +09:00
parent 84d17f2c44
commit f1863163a8
+3 -1
View File
@@ -248,9 +248,11 @@ static int
uzero_p(mpz_t *x)
{
if (x->sz == 0) return 1;
for (size_t i=x->sz-1; 0 <= i; i--)
for (size_t i=x->sz-1;; i--) {
if (x->p[i] != 0)
return 0;
if (i == 0) break;
}
return 1;
}