summaryrefslogtreecommitdiff
path: root/internal.h
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-03-08 04:50:22 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-03-08 04:50:22 +0000
commitb515528271a25e52cdbc28289436c94108141b4a (patch)
tree154cb627902a55ea3e0238829d79f5c983e74088 /internal.h
parent63c7ccc64b6337df88d2395312bf163786ba9056 (diff)
re-introduce __builtin_add_overflow
r57789 (74cdd89) was gradually "improve"d by naruse through r57793 to r57806, resulted in reverting the efect of r57789 while retaining its complexity. I think the current situation is slightly worse than before (same output complicated source code). Here I introduce __builtin_add_overflow again, which (I think) is what naruse wanted to do in r57793. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57807 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'internal.h')
-rw-r--r--internal.h9
1 files changed, 4 insertions, 5 deletions
diff --git a/internal.h b/internal.h
index f2e726ce6e..bc8d9d30d3 100644
--- a/internal.h
+++ b/internal.h
@@ -368,7 +368,7 @@ ntz_intptr(uintptr_t x)
# define DL2NUM(x) LL2NUM(x)
#elif defined(HAVE_INT128_T)
# define DLONG int128_t
-# define DL2NUM(x) ((RB_POSFIXABLE(x) && RB_NEGFIXABLE(x)) ? LONG2FIX(x) : rb_int128t2big(x))
+# define DL2NUM(x) (RB_FIXABLE(x) ? LONG2FIX(x) : rb_int128t2big(x))
VALUE rb_int128t2big(int128_t n);
#endif
@@ -1386,12 +1386,11 @@ rb_float_new_inline(double d)
static inline VALUE
rb_dbl2ival(double d)
{
- VALUE val;
- if (rb_long2fix_overflow(d, &val)) {
- return rb_dbl2big(d);
+ if (RB_FIXABLE(d)) {
+ return LONG2FIX((long)d);
}
else {
- return val;
+ return rb_dbl2big(d);
}
}