mruby-bigint (mpz_set_uint64): fixed a bug in for loop

Found double increments in a loop. Since no one called mpz_set_int64()
in the real code, we could not find this bug for long time.
This commit is contained in:
Yukihiro "Matz" Matsumoto
2024-09-30 22:59:06 +09:00
parent fe42f1d047
commit 5e6d382782
+1 -1
View File
@@ -101,7 +101,7 @@ mpz_set_uint64(mrb_state *mrb, mpz_t *y, uint64_t u)
y->sn = (u != 0);
mpz_realloc(mrb, y, len);
for (size_t i=0; i<len; i++) {
y->p[i++] = (mp_limb)LOW(u);
y->p[i] = (mp_limb)LOW(u);
u >>= DIG_SIZE;
}
}