From 7e36326c06a40dbe4900883cd180255e3beaa2e5 Mon Sep 17 00:00:00 2001 From: akr Date: Thu, 20 Jun 2013 13:52:19 +0000 Subject: [PATCH] * bignum.c (bignorm): Don't call bigtrunc if the result is a fixnum. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41500 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 4 ++++ bignum.c | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 2065b0d0da..c0f734922d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Thu Jun 20 22:49:27 2013 Tanaka Akira + + * bignum.c (bignorm): Don't call bigtrunc if the result is a fixnum. + Thu Jun 20 22:29:42 2013 Tanaka Akira * bignum.c (rb_uint2big): Refactored. diff --git a/bignum.c b/bignum.c index b0dc48c59b..be9c1e2740 100644 --- a/bignum.c +++ b/bignum.c @@ -322,7 +322,9 @@ static VALUE bignorm(VALUE x) { if (RB_TYPE_P(x, T_BIGNUM)) { - x = bigfixize(bigtrunc(x)); + x = bigfixize(x); + if (!FIXNUM_P(x)) + bigtrunc(x); } return x; }