Skip to content

Commit d4b3580

Browse files
committed
grok_bin_oct_hex: Move case: in switch()
This removes a special case, paving the way for potential future generalizations.
1 parent 68a142d commit d4b3580

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

numeric.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -429,8 +429,6 @@ Perl_grok_bin_oct_hex(pTHX_ const char *start,
429429
/* Unroll the loop so that the first 8 digits are branchless except for the
430430
* switch. A ninth hex one overflows a 32 bit word. */
431431
switch (e - s) {
432-
case 0:
433-
return 0;
434432
default:
435433
if (UNLIKELY(! generic_isCC_(*s, class_bit))) break;
436434
value = (value << shift) | XDIGIT_VALUE(*s);
@@ -470,7 +468,8 @@ Perl_grok_bin_oct_hex(pTHX_ const char *start,
470468
if (UNLIKELY(! generic_isCC_(*s, class_bit))) break;
471469
value = (value << shift) | XDIGIT_VALUE(*s);
472470
s++;
473-
471+
/* FALLTHROUGH */
472+
case 0:
474473
if (LIKELY(s >= e)) {
475474
return value;
476475
}

0 commit comments

Comments
 (0)