From 51c4ffa45b03262ddc183b815dba07462ef0a29f Mon Sep 17 00:00:00 2001
From: naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>
Date: Mon, 21 Mar 2016 13:36:03 +0000
Subject: * internal.h (rb_fix_divmod_fix): like r54213, use FIX2NUM only if  
 x == FIXNUM_MIN && y == -1. This must be a rare case and it is   expected
 compiler to handle well.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54216 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
---
 insns.def | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

(limited to 'insns.def')

diff --git a/insns.def b/insns.def
index b1e8265ce8..53f9bc0c16 100644
--- a/insns.def
+++ b/insns.def
@@ -1523,9 +1523,8 @@ opt_div
 {
     if (FIXNUM_2_P(recv, obj) &&
 	BASIC_OP_UNREDEFINED_P(BOP_DIV, FIXNUM_REDEFINED_OP_FLAG)) {
-	long y = FIX2LONG(obj);
-	if (y == 0) goto INSN_LABEL(normal_dispatch);
-	val = LONG2NUM(rb_div(FIX2LONG(recv), y));
+	if (FIX2LONG(obj) == 0) goto INSN_LABEL(normal_dispatch);
+	val = rb_fix_div_fix(recv, obj);
     }
     else if (FLONUM_2_P(recv, obj) &&
 	     BASIC_OP_UNREDEFINED_P(BOP_DIV, FLOAT_REDEFINED_OP_FLAG)) {
@@ -1561,9 +1560,8 @@ opt_mod
 {
     if (FIXNUM_2_P(recv, obj) &&
 	BASIC_OP_UNREDEFINED_P(BOP_MOD, FIXNUM_REDEFINED_OP_FLAG )) {
-	long y = FIX2LONG(obj);
-	if (y == 0) goto INSN_LABEL(normal_dispatch);
-	val = LONG2FIX(rb_mod(FIX2LONG(recv), y));
+	if (FIX2LONG(obj) == 0) goto INSN_LABEL(normal_dispatch);
+	val = rb_fix_mod_fix(recv, obj);
     }
     else if (FLONUM_2_P(recv, obj) &&
 	     BASIC_OP_UNREDEFINED_P(BOP_MOD, FLOAT_REDEFINED_OP_FLAG)) {
-- 
cgit v1.2.3

