From ab4379e086d69b13f4446bb0bddd87844650ea1a Mon Sep 17 00:00:00 2001 From: Takashi Kokubun Date: Thu, 17 Nov 2022 17:55:24 -0800 Subject: Refactor RB_SPECIAL_CONST_P (#6759) Since https://github.com/ruby/ruby/pull/6599, RUBY_IMMEDIATE_MASK also overlaps RUBY_Qnil. Now RB_SPECIAL_CONST_P seems confusing since both RB_IMMEDIATE_P and RB_TEST check for RUBY_Qnil while we only need to check RUBY_Qnil besides RUBY_IMMEDIATE_MASK. I'd like to make this change to make it less confusing. I confirmed that this doesn't change the number of instructions used for the RUBY_Qfalse check on Linux x86_64 GCC and macOS arm64 Clang. --- include/ruby/internal/special_consts.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/ruby/internal/special_consts.h b/include/ruby/internal/special_consts.h index ed2428e087..dc0a6b41d6 100644 --- a/include/ruby/internal/special_consts.h +++ b/include/ruby/internal/special_consts.h @@ -326,7 +326,7 @@ RBIMPL_ATTR_ARTIFICIAL() static inline bool RB_SPECIAL_CONST_P(VALUE obj) { - return RB_IMMEDIATE_P(obj) || ! RB_TEST(obj); + return RB_IMMEDIATE_P(obj) || obj == RUBY_Qfalse; } RBIMPL_ATTR_CONST() -- cgit v1.2.1