diff options
author | Yusuke Endoh <mame@ruby-lang.org> | 2021-01-23 16:05:33 +0900 |
---|---|---|
committer | Yusuke Endoh <mame@ruby-lang.org> | 2021-01-23 16:05:33 +0900 |
commit | dd65aa95f9bf017674b9f11c9e5824cd0fa22735 (patch) | |
tree | 89561db827584e69a4cb3d2da781ef275d523c34 /bignum.c | |
parent | 05f89dd13bee427ffa43568ab95668da55b127cf (diff) |
bignum.c: Make sure the argument of LONG2FIX is long
... because BDIGIT_DBL may be long long. POSFIXABLE and NEGFIXABLE
ensures that the value is representable as long, but it failed to build
on emscripten with -Werror -Wshorten-64-to-32.
Diffstat (limited to 'bignum.c')
-rw-r--r-- | bignum.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -3689,10 +3689,10 @@ rb_integer_unpack(const void *words, size_t numwords, size_t wordsize, size_t na if (u == 0) return LONG2FIX(0); if (0 < sign && POSFIXABLE(u)) - return LONG2FIX(u); + return LONG2FIX((long)u); if (sign < 0 && BDIGIT_MSB(fixbuf[1]) == 0 && NEGFIXABLE(-(BDIGIT_DBL_SIGNED)u)) - return LONG2FIX(-(BDIGIT_DBL_SIGNED)u); + return LONG2FIX((long)-(BDIGIT_DBL_SIGNED)u); val = bignew((long)num_bdigits, 0 <= sign); MEMCPY(BDIGITS(val), fixbuf, BDIGIT, num_bdigits); } @@ -4487,14 +4487,14 @@ rb_ll2big(LONG_LONG n) VALUE rb_ull2inum(unsigned LONG_LONG n) { - if (POSFIXABLE(n)) return LONG2FIX(n); + if (POSFIXABLE(n)) return LONG2FIX((long)n); return rb_ull2big(n); } VALUE rb_ll2inum(LONG_LONG n) { - if (FIXABLE(n)) return LONG2FIX(n); + if (FIXABLE(n)) return LONG2FIX((long)n); return rb_ll2big(n); } |