Skip to content

Commit cf1f49e

Browse files
committed
Define RB_FLOAT_TYPE_P as a macro in ruby.h like MRI
1 parent d2f1c3f commit cf1f49e

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

lib/cext/include/ruby/ruby.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -558,12 +558,15 @@ enum ruby_value_type {
558558
int rb_type(VALUE value);
559559
#define TYPE(x) rb_type((VALUE)(x))
560560

561-
/* Truffle: Simplify the RB_FLOAT_TYPE_P check based on our representation of Floats.
561+
#ifdef TRUFFLERUBY
562+
/* TruffleRuby: Simplify the RB_FLOAT_TYPE_P check based on our representation of Floats. */
563+
#define RB_FLOAT_TYPE_P(obj) (\
564+
polyglot_as_boolean(polyglot_invoke(RUBY_CEXT, "RB_FLOAT_TYPE_P", rb_tr_unwrap(value))))
565+
#else
562566
#define RB_FLOAT_TYPE_P(obj) (\
563567
RB_FLONUM_P(obj) || \
564568
(!RB_SPECIAL_CONST_P(obj) && RB_BUILTIN_TYPE(obj) == RUBY_T_FLOAT))
565-
*/
566-
MUST_INLINE int RB_FLOAT_TYPE_P(VALUE obj);
569+
#endif
567570

568571
bool RB_TYPE_P(VALUE value, int type);
569572

src/main/c/cext/ruby.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -419,10 +419,6 @@ int RB_FIXNUM_P(VALUE value) {
419419
return polyglot_as_boolean(RUBY_CEXT_INVOKE_NO_WRAP("RB_FIXNUM_P", value));
420420
}
421421

422-
int RB_FLOAT_TYPE_P(VALUE value) {
423-
return polyglot_as_boolean(RUBY_CEXT_INVOKE_NO_WRAP("RB_FLOAT_TYPE_P", value));
424-
}
425-
426422
int RTEST(VALUE value) {
427423
return value != NULL && polyglot_as_boolean(RUBY_CEXT_INVOKE_NO_WRAP("RTEST", value));
428424
}

0 commit comments

Comments
 (0)