From 26843cbcd0b97489f98aa123e700c4e893b1da5e Mon Sep 17 00:00:00 2001 From: "NARUSE, Yui" Date: Thu, 7 Nov 2019 18:48:51 +0900 Subject: Use FIX2LONG to avoid unexpected exception Though it won't happen in the real world in this context, FIX2INT may raise an exception and it cause to generate extra code. --- numeric.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'numeric.c') diff --git a/numeric.c b/numeric.c index c1655c0dbd..da224de97a 100644 --- a/numeric.c +++ b/numeric.c @@ -1461,7 +1461,7 @@ flo_cmp(VALUE x, VALUE y) if (RB_TYPE_P(y, T_FIXNUM) || RB_TYPE_P(y, T_BIGNUM)) { VALUE rel = rb_integer_float_cmp(y, x); if (FIXNUM_P(rel)) - return INT2FIX(-FIX2INT(rel)); + return LONG2FIX(-FIX2LONG(rel)); return rel; } else if (RB_TYPE_P(y, T_FLOAT)) { -- cgit v1.2.3