summaryrefslogtreecommitdiff
path: root/numeric.c
diff options
context:
space:
mode:
Diffstat (limited to 'numeric.c')
-rw-r--r--numeric.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/numeric.c b/numeric.c
index 97e22c058c..23d35a1cd5 100644
--- a/numeric.c
+++ b/numeric.c
@@ -2226,12 +2226,9 @@ static VALUE
fix_equal(x, y)
VALUE x, y;
{
- if (FIXNUM_P(y)) {
- return (FIX2LONG(x) == FIX2LONG(y))?Qtrue:Qfalse;
- }
- else {
- return num_equal(x, y);
- }
+ if (x == y) return Qtrue;
+ if (FIXNUM_P(y)) return Qfalse;
+ return num_equal(x, y);
}
/*
@@ -2247,10 +2244,10 @@ static VALUE
fix_cmp(x, y)
VALUE x, 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);
return INT2FIX(-1);
}