[前][次][番号順一覧][スレッド一覧]

ruby-changes:69461

From: Nobuyoshi <ko1@a...>
Date: Wed, 27 Oct 2021 02:05:18 +0900 (JST)
Subject: [ruby-changes:69461] 26353c75a9 (master): Embed bare `double` if `sizeof(double) == sizeof(VALUE)`

https://git.ruby-lang.org/ruby.git/commit/?id=26353c75a9

From 26353c75a94469bad7a0e6a6aa81d968e64952d5 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Wed, 27 Oct 2021 00:50:41 +0900
Subject: Embed bare `double` if `sizeof(double) == sizeof(VALUE)`

---
 internal/numeric.h | 4 ++--
 numeric.c          | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/internal/numeric.h b/internal/numeric.h
index 440bef16711..19069cb3bc7 100644
--- a/internal/numeric.h
+++ b/internal/numeric.h
@@ -35,7 +35,7 @@ enum ruby_num_rounding_mode { https://github.com/ruby/ruby/blob/trunk/internal/numeric.h#L35
     RUBY_NUM_ROUND_DEFAULT = ROUND_DEFAULT,
 };
 
-#if SIZEOF_DOUBLE < SIZEOF_VALUE
+#if SIZEOF_DOUBLE <= SIZEOF_VALUE
 typedef double rb_float_value_type;
 #else
 typedef struct {
@@ -218,7 +218,7 @@ rb_float_flonum_value(VALUE v) https://github.com/ruby/ruby/blob/trunk/internal/numeric.h#L218
 static inline double
 rb_float_noflonum_value(VALUE v)
 {
-#if SIZEOF_DOUBLE < SIZEOF_VALUE
+#if SIZEOF_DOUBLE <= SIZEOF_VALUE
     return RFLOAT(v)->float_value;
 #else
     union {
diff --git a/numeric.c b/numeric.c
index 3ee98343a73..715f11c6319 100644
--- a/numeric.c
+++ b/numeric.c
@@ -951,7 +951,7 @@ rb_float_new_in_heap(double d) https://github.com/ruby/ruby/blob/trunk/numeric.c#L951
 {
     NEWOBJ_OF(flt, struct RFloat, rb_cFloat, T_FLOAT | (RGENGC_WB_PROTECTED_FLOAT ? FL_WB_PROTECTED : 0));
 
-#if SIZEOF_DOUBLE < SIZEOF_VALUE
+#if SIZEOF_DOUBLE <= SIZEOF_VALUE
     flt->float_value = d;
 #else
     union {
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]