mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user