mruby-bigint: fix signed/unsigned comparison warning

Cast base parameter to uint64_t in mpz_get_str power-of-2 path to
resolve C4018 warning about signed/unsigned mismatch. The comparison
now properly compares two unsigned values: ((uint64_t)1 << shift)
with (uint64_t)base.

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Yukihiro "Matz" Matsumoto
2025-08-22 22:28:07 +09:00
parent cc71d93714
commit 2580d69782
+1 -1
View File
@@ -1942,7 +1942,7 @@ mpz_get_str(mpz_ctx_t *ctx, char *s, mrb_int sz, mrb_int base, mpz_t *x)
if ((base & (base - 1)) == 0) { // base is a power of 2
int shift = 0;
while (((uint64_t)1 << shift) < base) shift++;
while (((uint64_t)1 << shift) < (uint64_t)base) shift++;
mp_limb mask = (mp_limb)base - 1;
mp_dbl_limb value = 0;
int bits = 0;