From c179584ba4949a6f569e2c0734a6f01dbdae3f60 Mon Sep 17 00:00:00 2001
From: usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>
Date: Tue, 26 Jun 2007 06:23:34 +0000
Subject: 	* include/ruby/ruby.h: IL32LLP64 support.

	* bignum.c (bigfixize, rb_cstr_to_inum): ditto.

	* insns.def (opt_plus, opt_minus, opt_mult): ditto.



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

(limited to 'insns.def')

diff --git a/insns.def b/insns.def
index 9e8ceb49cd..9db85ff162 100644
--- a/insns.def
+++ b/insns.def
@@ -1623,12 +1623,25 @@ opt_plus
     else if (FIXNUM_2_P(recv, obj) &&
 	     BASIC_OP_UNREDEFINED_P(BOP_PLUS)) {
 	/* fixnum + fixnum */
+#ifndef LONG_LONG_VALUE
 	val = (recv + (obj & (~1)));
 	if ((~(recv ^ obj) & (recv ^ val)) &
 	    ((VALUE)0x01 << ((sizeof(VALUE) * CHAR_BIT) - 1))) {
 	    val = rb_big_plus(rb_int2big(FIX2INT(recv)),
 			      rb_int2big(FIX2INT(obj)));
 	}
+#else
+	long a, b, c;
+	a = FIX2LONG(recv);
+	b = FIX2LONG(obj);
+	c = a + b;
+	if (FIXABLE(c)) {
+	    val = LONG2FIX(c);
+	}
+	else {
+	    val = rb_big_plus(rb_int2big(a), rb_int2big(b));
+	}
+#endif
     }
 #endif
 
@@ -1686,9 +1699,11 @@ opt_minus
 	a = FIX2LONG(recv);
 	b = FIX2LONG(obj);
 	c = a - b;
-	val = LONG2FIX(c);
 
-	if (FIX2LONG(val) != c) {
+	if (FIXABLE(c)) {
+	    val = LONG2FIX(c);
+	}
+	else {
 	    val = rb_big_minus(rb_int2big(a), rb_int2big(b));
 	}
     }
@@ -1722,9 +1737,11 @@ opt_mult
 	else {
 	    b = FIX2LONG(obj);
 	    c = a * b;
-	    val = LONG2FIX(c);
 
-	    if (FIX2LONG(val) != c || c / a != b) {
+	    if (FIXABLE(c) && c / a == b) {
+		val = LONG2FIX(c);
+	    }
+	    else {
 		val = rb_big_mul(rb_int2big(a), rb_int2big(b));
 	    }
 	}
-- 
cgit v1.2.3

