Skip to content

Commit e004969

Browse files
committed
grok_bin_oct_hex: Add two UNLIKELY()s
Underscores in numbers are much less common than digits, and its unlikely that this iteration of the loop through all the digits will still have a running total of 0.
1 parent 0e943ce commit e004969

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

numeric.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ Perl_grok_bin_oct_hex(pTHX_ const char * const start,
551551
continue;
552552
}
553553

554-
if ( *s == '_'
554+
if ( UNLIKELY(*s == '_')
555555
&& s < e - 1
556556
&& allow_underscores
557557
&& generic_isCC_(s[1], class_bit)
@@ -567,7 +567,7 @@ Perl_grok_bin_oct_hex(pTHX_ const char * const start,
567567
/* To get here with the value so-far being 0 means we've only had
568568
* leading zeros, then an underscore. We can continue with the
569569
* branchless switch() instead of this loop */
570-
if (value == 0) {
570+
if (UNLIKELY(value == 0)) {
571571
goto redo_switch;
572572
}
573573
else {

0 commit comments

Comments
 (0)