GitHub

@@ -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))

70707171

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 */

86868787

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));

100100101101

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

}

Read the original on github.com ↗