diff --git a/lib/cext/ABI_version.txt b/lib/cext/ABI_version.txt index 0cfbf08886fc..00750edc07d6 100644 --- a/lib/cext/ABI_version.txt +++ b/lib/cext/ABI_version.txt @@ -1 +1 @@ -2 +3 diff --git a/lib/cext/include/ruby/internal/arithmetic/fixnum.h b/lib/cext/include/ruby/internal/arithmetic/fixnum.h index 852330430ce0..c8927ac82431 100644 --- a/lib/cext/include/ruby/internal/arithmetic/fixnum.h +++ b/lib/cext/include/ruby/internal/arithmetic/fixnum.h @@ -40,11 +40,7 @@ * represent is 4,611,686,018,427,387,904, which is not fixable. The * seemingly-strange "< FIXNUM_MAX + 1" expression below is due to this. */ -#ifdef TRUFFLERUBY -#define RB_POSFIXABLE(f) ((f) <= RUBY_FIXNUM_MAX) -#else #define RB_POSFIXABLE(_) ((_) < RUBY_FIXNUM_MAX + 1) -#endif /** * Checks if the passed value is in range of fixnum, assuming it is a negative @@ -55,15 +51,10 @@ /** Checks if the passed value is in range of fixnum */ #define RB_FIXABLE(_) (RB_POSFIXABLE(_) && RB_NEGFIXABLE(_)) -#ifdef TRUFFLERUBY -#define RUBY_FIXNUM_MAX LONG_MAX -#define RUBY_FIXNUM_MIN LONG_MIN -#else /** Maximum possible value that a fixnum can represent. */ #define RUBY_FIXNUM_MAX (LONG_MAX / 2) /** Minimum possible value that a fixnum can represent. */ #define RUBY_FIXNUM_MIN (LONG_MIN / 2) -#endif /* TRUFFLERUBY */ #endif /* RBIMPL_ARITHMETIC_FIXNUM_H */ diff --git a/lib/cext/include/ruby/internal/arithmetic/long.h b/lib/cext/include/ruby/internal/arithmetic/long.h index 73237bf3b1a8..40cc9714f5f0 100644 --- a/lib/cext/include/ruby/internal/arithmetic/long.h +++ b/lib/cext/include/ruby/internal/arithmetic/long.h @@ -120,9 +120,6 @@ RBIMPL_ATTR_ARTIFICIAL() static inline VALUE RB_INT2FIX(long i) { -#ifdef TRUFFLERUBY - return rb_tr_longwrap(i); -#else RBIMPL_ASSERT_OR_ASSUME(RB_FIXABLE(i)); /* :NOTE: VALUE can be wider than long. As j being unsigned, 2j+1 is fully @@ -135,7 +132,6 @@ RB_INT2FIX(long i) RBIMPL_ASSERT_OR_ASSUME(RB_FIXNUM_P(n)); return n; -#endif } /** diff --git a/src/main/c/cext/integer.c b/src/main/c/cext/integer.c index 51a8427f8336..29b324ece685 100644 --- a/src/main/c/cext/integer.c +++ b/src/main/c/cext/integer.c @@ -157,6 +157,6 @@ int rb_absint_singlebit_p(VALUE val) { } VALUE rb_int2big(intptr_t n) { - // it cannot overflow Fixnum - return LONG2FIX(n); + // intptr_t is the same as long + return rb_tr_longwrap(n); }