diff options
-rw-r--r-- | numeric.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -423,9 +423,8 @@ Perl_grok_bin_oct_hex(pTHX_ const char *start, s = s0; /* s0 potentially advanced from 'start' */ - /* Unroll the loop so that the first 7 digits are branchless except for the - * switch. An eighth one could overflow a 32 bit word. This should - * completely handle the common case without needing extra checks */ + /* Unroll the loop so that the first 8 digits are branchless except for the + * switch. A ninth one overflows a 32 bit word. */ switch (len) { case 0: return 0; @@ -434,6 +433,11 @@ Perl_grok_bin_oct_hex(pTHX_ const char *start, value = (value << shift) | XDIGIT_VALUE(*s); s++; /* FALLTHROUGH */ + case 7: + if (! _generic_isCC(*s, class_bit)) break; + value = (value << shift) | XDIGIT_VALUE(*s); + s++; + /* FALLTHROUGH */ case 6: if (! _generic_isCC(*s, class_bit)) break; value = (value << shift) | XDIGIT_VALUE(*s); @@ -463,7 +467,7 @@ Perl_grok_bin_oct_hex(pTHX_ const char *start, if (! _generic_isCC(*s, class_bit)) break; value = (value << shift) | XDIGIT_VALUE(*s); - if (LIKELY(len <= 7)) { + if (LIKELY(len <= 8)) { return value; } |