mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* numeric.c (fix_equal): remove FIX2LONG() to optimize. suggested
in http://t-a-w.blogspot.com/2007/02/making-ruby-faster.html. [ruby-talk:240223] * numeric.c (fix_cmp): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11807 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
e3b0b6d5fe
commit
f67795869d
2 changed files with 15 additions and 17 deletions
|
@ -1,3 +1,11 @@
|
|||
Wed Feb 21 17:40:37 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* numeric.c (fix_equal): remove FIX2LONG() to optimize. suggested
|
||||
in http://t-a-w.blogspot.com/2007/02/making-ruby-faster.html.
|
||||
[ruby-talk:240223]
|
||||
|
||||
* numeric.c (fix_cmp): ditto.
|
||||
|
||||
Wed Feb 21 09:14:04 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* eval_load.c (rb_require_safe): should restore safe level.
|
||||
|
|
24
numeric.c
24
numeric.c
|
@ -2312,7 +2312,7 @@ static VALUE
|
|||
fix_equal(VALUE x, VALUE y)
|
||||
{
|
||||
if (FIXNUM_P(y)) {
|
||||
return (FIX2LONG(x) == FIX2LONG(y))?Qtrue:Qfalse;
|
||||
return (x == y)?Qtrue:Qfalse;
|
||||
}
|
||||
switch (TYPE(y)) {
|
||||
case T_BIGNUM:
|
||||
|
@ -2336,11 +2336,9 @@ fix_equal(VALUE x, VALUE y)
|
|||
static VALUE
|
||||
fix_cmp(VALUE x, VALUE y)
|
||||
{
|
||||
if (x == y) return INT2FIX(0);
|
||||
if (FIXNUM_P(y)) {
|
||||
long a = FIX2LONG(x), b = FIX2LONG(y);
|
||||
|
||||
if (a == b) return INT2FIX(0);
|
||||
if (a > b) return INT2FIX(1);
|
||||
if (FIX2LONG(x) > FIX2LONG(y)) return INT2FIX(1);
|
||||
return INT2FIX(-1);
|
||||
}
|
||||
switch (TYPE(y)) {
|
||||
|
@ -2365,9 +2363,7 @@ static VALUE
|
|||
fix_gt(VALUE x, VALUE y)
|
||||
{
|
||||
if (FIXNUM_P(y)) {
|
||||
long a = FIX2LONG(x), b = FIX2LONG(y);
|
||||
|
||||
if (a > b) return Qtrue;
|
||||
if (FIX2LONG(x) > FIX2LONG(y)) return Qtrue;
|
||||
return Qfalse;
|
||||
}
|
||||
switch (TYPE(y)) {
|
||||
|
@ -2392,9 +2388,7 @@ static VALUE
|
|||
fix_ge(VALUE x, VALUE y)
|
||||
{
|
||||
if (FIXNUM_P(y)) {
|
||||
long a = FIX2LONG(x), b = FIX2LONG(y);
|
||||
|
||||
if (a >= b) return Qtrue;
|
||||
if (FIX2LONG(x) >= FIX2LONG(y)) return Qtrue;
|
||||
return Qfalse;
|
||||
}
|
||||
switch (TYPE(y)) {
|
||||
|
@ -2419,9 +2413,7 @@ static VALUE
|
|||
fix_lt(VALUE x, VALUE y)
|
||||
{
|
||||
if (FIXNUM_P(y)) {
|
||||
long a = FIX2LONG(x), b = FIX2LONG(y);
|
||||
|
||||
if (a < b) return Qtrue;
|
||||
if (FIX2LONG(x) < FIX2LONG(y)) return Qtrue;
|
||||
return Qfalse;
|
||||
}
|
||||
switch (TYPE(y)) {
|
||||
|
@ -2446,9 +2438,7 @@ static VALUE
|
|||
fix_le(VALUE x, VALUE y)
|
||||
{
|
||||
if (FIXNUM_P(y)) {
|
||||
long a = FIX2LONG(x), b = FIX2LONG(y);
|
||||
|
||||
if (a <= b) return Qtrue;
|
||||
if (FIX2LONG(x) <= FIX2LONG(y)) return Qtrue;
|
||||
return Qfalse;
|
||||
}
|
||||
switch (TYPE(y)) {
|
||||
|
|
Loading…
Reference in a new issue