Skip to content

Commit 6442a01

Browse files
committed
symbol.c (SYMBOL_INLINE_P): inline symbol to occupy 26 bits in mrb_sym
It used to occupy 30 bits, but we need 2 more bits to keep method visibility in the method tables.
1 parent 3e6abfd commit 6442a01

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎src/symbol.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ sym_validate_len(mrb_state *mrb, size_t len)
6666
# define sym_inline_pack(name, len) 0
6767
# define sym_inline_unpack(sym, buf, lenp) NULL
6868
#else
69-
# define SYMBOL_INLINE_P(sym) ((sym) >= (1<<24))
69+
# define SYMBOL_INLINE_P(sym) ((sym) > (1<<20))
7070

7171
static const char pack_table[] = "_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
7272

@@ -85,7 +85,7 @@ sym_inline_pack(const char *name, size_t len)
8585
if (p == 0) return 0; /* non alnum char */
8686

8787
uint32_t bits = (uint32_t)(p - pack_table)+1;
88-
sym |= bits<<(24-i*6);
88+
sym |= bits<<(20-i*6);
8989
}
9090
mrb_assert(SYMBOL_INLINE_P(sym));
9191
return sym;
@@ -99,7 +99,7 @@ sym_inline_unpack(mrb_sym sym, char *buf, mrb_int *lenp)
9999
mrb_assert(SYMBOL_INLINE_P(sym));
100100

101101
for (i=0; i<5; i++) {
102-
uint32_t bits = sym>>(24-i*6) & 0x3f;
102+
uint32_t bits = sym>>(20-i*6) & 0x3f;
103103
if (bits == 0) break;
104104
buf[i] = pack_table[bits-1];
105105
}

0 commit comments

Comments
 (0)