diff options
author | charliesome <charliesome@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-04-22 13:57:21 +0000 |
---|---|---|
committer | charliesome <charliesome@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-04-22 13:57:21 +0000 |
commit | 4f683e16781ea6c856a02bc42b1b57f66a0019fb () | |
tree | ec4bdc106fc3cbbef589bfd763b53b625847f73a | |
parent | e9b63c1a225f039b90faf16c5969c658d925dd37 (diff) |
* insns.def (opt_mod): Use % operator if both operands are positive for
a significant performance improvement. Thanks to @samsaffron. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40410 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | insns.def | 10 |
2 files changed, 11 insertions, 4 deletions
@@ -1,3 +1,8 @@ Mon Apr 22 17:09:37 2013 Nobuyoshi Nakada <[email protected]> * marshal.c (r_object0): copy all instance variables not only generic @@ -1524,13 +1524,15 @@ opt_mod { if (FIXNUM_2_P(recv, obj) && BASIC_OP_UNREDEFINED_P(BOP_MOD, FIXNUM_REDEFINED_OP_FLAG )) { - long x, y, mod; x = FIX2LONG(recv); y = FIX2LONG(obj); - { /* copied from numeric.c#fixdivmod */ - long div; if (y == 0) rb_num_zerodiv(); @@ -1551,8 +1553,8 @@ opt_mod mod += y; div -= 1; } } - val = LONG2FIX(mod); } else if (FLONUM_2_P(recv, obj) && BASIC_OP_UNREDEFINED_P(BOP_MOD, FLOAT_REDEFINED_OP_FLAG)) { |