From 11d5a8318dd5e30bb3ecab80e2f2177bcdef3e34 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Wed, 8 Apr 2020 18:03:46 +0900 Subject: Suppress C4244 "possible loss of data" warnings --- enumerator.c | 2 +- include/ruby/3/core/rarray.h | 2 +- include/ruby/3/core/rstring.h | 2 +- numeric.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/enumerator.c b/enumerator.c index f5669fd48a..1a1fd14536 100644 --- a/enumerator.c +++ b/enumerator.c @@ -3841,7 +3841,7 @@ arith_seq_size(VALUE self) n = ruby_float_step_size(NUM2DBL(b), ee, NUM2DBL(s), x); if (isinf(n)) return DBL2NUM(n); - if (POSFIXABLE(n)) return LONG2FIX(n); + if (POSFIXABLE(n)) return LONG2FIX((long)n); return rb_dbl2big(n); } diff --git a/include/ruby/3/core/rarray.h b/include/ruby/3/core/rarray.h index ddc50117ef..f4f6809874 100644 --- a/include/ruby/3/core/rarray.h +++ b/include/ruby/3/core/rarray.h @@ -123,7 +123,7 @@ RARRAY_EMBED_LEN(VALUE ary) VALUE f = RBASIC(ary)->flags; f &= RARRAY_EMBED_LEN_MASK; f >>= RARRAY_EMBED_LEN_SHIFT; - return f; + return (long)f; } RUBY3_ATTR_PURE_ON_NDEBUG() diff --git a/include/ruby/3/core/rstring.h b/include/ruby/3/core/rstring.h index 266edca9b6..3d40f850bc 100644 --- a/include/ruby/3/core/rstring.h +++ b/include/ruby/3/core/rstring.h @@ -108,7 +108,7 @@ RSTRING_EMBED_LEN(VALUE str) VALUE f = RBASIC(str)->flags; f &= RSTRING_EMBED_LEN_MASK; f >>= RSTRING_EMBED_LEN_SHIFT; - return f; + return (long)f; } RUBY3_ATTR_PURE_ON_NDEBUG() diff --git a/numeric.c b/numeric.c index 801370aa43..40a381f70f 100644 --- a/numeric.c +++ b/numeric.c @@ -2587,7 +2587,7 @@ ruby_num_interval_step_size(VALUE from, VALUE to, VALUE step, int excl) double n = ruby_float_step_size(NUM2DBL(from), NUM2DBL(to), NUM2DBL(step), excl); if (isinf(n)) return DBL2NUM(n); - if (POSFIXABLE(n)) return LONG2FIX(n); + if (POSFIXABLE(n)) return LONG2FIX((long)n); return rb_dbl2big(n); } else { -- cgit v1.2.3