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