diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2022-10-20 10:57:40 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2022-10-20 22:05:27 +0900 |
commit | f55212bce939f736559709a8cd16c409772389c8 (patch) | |
tree | 93e8bd23eb1317ccbc16faf685fb9a4138470f29 /include | |
parent | 1e66d3b8532539a53cf97bcca477d0a8b4b426bc (diff) |
Move "special consts" so `Qundef` and `Qnil` differ just 1 bit
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/6599
Diffstat (limited to 'include')
-rw-r--r-- | include/ruby/internal/abi.h | 2 | ||||
-rw-r--r-- | include/ruby/internal/special_consts.h | 22 |
2 files changed, 12 insertions, 12 deletions
diff --git a/include/ruby/internal/abi.h b/include/ruby/internal/abi.h index fe1977a9a1..d67aa0d509 100644 --- a/include/ruby/internal/abi.h +++ b/include/ruby/internal/abi.h @@ -24,7 +24,7 @@ * In released versions of Ruby, this number is not defined since teeny * versions of Ruby should guarantee ABI compatibility. */ -#define RUBY_ABI_VERSION 2 +#define RUBY_ABI_VERSION 3 /* Windows does not support weak symbols so ruby_abi_version will not exist * in the shared library. */ diff --git a/include/ruby/internal/special_consts.h b/include/ruby/internal/special_consts.h index 252f1a8ff5..a8c992ef5e 100644 --- a/include/ruby/internal/special_consts.h +++ b/include/ruby/internal/special_consts.h @@ -94,9 +94,9 @@ ruby_special_consts { RUBY_SYMBOL_FLAG, /**< Flag to denote a static symbol. */ #elif USE_FLONUM RUBY_Qfalse = 0x00, /* ...0000 0000 */ + RUBY_Qnil = 0x04, /* ...0000 0100 */ RUBY_Qtrue = 0x14, /* ...0001 0100 */ - RUBY_Qnil = 0x08, /* ...0000 1000 */ - RUBY_Qundef = 0x34, /* ...0011 0100 */ + RUBY_Qundef = 0x24, /* ...0010 0100 */ RUBY_IMMEDIATE_MASK = 0x07, /* ...0000 0111 */ RUBY_FIXNUM_FLAG = 0x01, /* ...xxxx xxx1 */ RUBY_FLONUM_MASK = 0x03, /* ...0000 0011 */ @@ -104,9 +104,9 @@ ruby_special_consts { RUBY_SYMBOL_FLAG = 0x0c, /* ...xxxx 1100 */ #else RUBY_Qfalse = 0x00, /* ...0000 0000 */ - RUBY_Qtrue = 0x02, /* ...0000 0010 */ - RUBY_Qnil = 0x04, /* ...0000 0100 */ - RUBY_Qundef = 0x06, /* ...0000 0110 */ + RUBY_Qnil = 0x02, /* ...0000 0010 */ + RUBY_Qtrue = 0x06, /* ...0000 0110 */ + RUBY_Qundef = 0x0a, /* ...0000 1010 */ RUBY_IMMEDIATE_MASK = 0x03, /* ...0000 0011 */ RUBY_FIXNUM_FLAG = 0x01, /* ...xxxx xxx1 */ RUBY_FLONUM_MASK = 0x00, /* any values ANDed with FLONUM_MASK cannot be FLONUM_FLAG */ @@ -138,19 +138,19 @@ RB_TEST(VALUE obj) /* * if USE_FLONUM * Qfalse: ....0000 0000 - * Qnil: ....0000 1000 - * ~Qnil: ....1111 0111 + * Qnil: ....0000 0100 + * ~Qnil: ....1111 1011 * v ....xxxx xxxx * ---------------------------- - * RTEST(v) ....xxxx 0xxx + * RTEST(v) ....xxxx x0xx * * if ! USE_FLONUM * Qfalse: ....0000 0000 - * Qnil: ....0000 0100 - * ~Qnil: ....1111 1011 + * Qnil: ....0000 0010 + * ~Qnil: ....1111 1101 * v ....xxxx xxxx * ---------------------------- - * RTEST(v) ....xxxx x0xx + * RTEST(v) ....xxxx xx0x * * RTEST(v) can be 0 if and only if (v == Qfalse || v == Qnil). */ |