diff options
author | Takashi Kokubun <takashikkbn@gmail.com> | 2022-11-17 17:55:24 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-17 17:55:24 -0800 |
commit | ab4379e086d69b13f4446bb0bddd87844650ea1a (patch) | |
tree | 9c51f055a309f0b13e904940abb6c7953eb4d5f4 /include/ruby | |
parent | d8202a52a5fedd2209248b030ea6c41382f5f3e2 (diff) | |
download | ruby-ab4379e086d69b13f4446bb0bddd87844650ea1a.tar.gz |
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.
Diffstat (limited to 'include/ruby')
-rw-r--r-- | include/ruby/internal/special_consts.h | 2 |
1 files changed, 1 insertions, 1 deletions
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() |