mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Fix inline packed symbols on 32 bit mode with MRB_WORD_BOXING
This commit is contained in:
+7
-2
@@ -34,13 +34,18 @@ static const char pack_table[] = "_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRS
|
||||
static mrb_sym
|
||||
sym_inline_pack(const char *name, uint16_t len)
|
||||
{
|
||||
enum {
|
||||
lower_length_max = (MRB_SYMBOL_BITSIZE - 2) / 5,
|
||||
mix_length_max = (MRB_SYMBOL_BITSIZE - 2) / 6
|
||||
};
|
||||
|
||||
char c;
|
||||
const char *p;
|
||||
int i;
|
||||
mrb_sym sym = 0;
|
||||
int lower = 1;
|
||||
|
||||
if (len > 6) return 0; /* too long */
|
||||
if (len > lower_length_max) return 0; /* too long */
|
||||
for (i=0; i<len; i++) {
|
||||
uint32_t bits;
|
||||
|
||||
@@ -64,7 +69,7 @@ sym_inline_pack(const char *name, uint16_t len)
|
||||
}
|
||||
return sym | 3;
|
||||
}
|
||||
if (len == 6) return 0;
|
||||
if (len > mix_length_max) return 0;
|
||||
return sym | 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user