diff options
author | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-03-06 11:14:05 +0000 |
---|---|---|
committer | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-03-06 11:14:05 +0000 |
commit | 74cdd893eb102ba98e735f2a24c710e1928261a9 (patch) | |
tree | 148c82adfc714aaa2a3d60cda2c18c4f78ed9f76 /insns.def | |
parent | cf2a68662aadcbed4a92cfdad4d992f894f3767f (diff) | |
download | ruby-74cdd893eb102ba98e735f2a24c710e1928261a9.tar.gz |
optimize FIXABLE macro
Looking at the source code, FIXABLE tends to be just before LOING2FIX
to check applicability of that operation. Why not try computing first
then check for overflow, which should be optimial.
I also tried the same thing for unsigned types but resulted in slower
execution. It seems RB_POSFIXABLE() is fast enough on modern CPUs.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57789 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'insns.def')
-rw-r--r-- | insns.def | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -1345,7 +1345,7 @@ opt_case_dispatch if (RB_FLOAT_TYPE_P(key)) { double kval = RFLOAT_VALUE(key); if (!isinf(kval) && modf(kval, &kval) == 0.0) { - key = FIXABLE(kval) ? LONG2FIX((long)kval) : rb_dbl2big(kval); + key = rb_dbl2ival(kval); } } if (st_lookup(RHASH_TBL_RAW(hash), key, &val)) { |