Skip to content

Commit ab1d647

Browse files
committed
Small cleanups
1 parent fc98c63 commit ab1d647

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

lib/Common/Common/NumberUtilities.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -540,10 +540,12 @@ using namespace Js;
540540
byte bExtra = 0;
541541
int cbit = 0;
542542
const EncodedChar* pszSave = psz;
543+
543544
// Skip leading zeros.
544545
LSkipZeroes:
545546
while (*psz == '0')
546547
psz++;
548+
547549
// Get the first digit.
548550
uT = *psz - '0';
549551
if (uT > 1)
@@ -553,11 +555,7 @@ using namespace Js;
553555
// - we've walked past at least one zero character (ie: this isn't the first character in psz)
554556
// - the previous character was a zero
555557
// - the following character is a valid binary digit
556-
if (*psz == '_' &&
557-
isNumericSeparatorEnabled &&
558-
pszSave < psz &&
559-
psz[-1] == '0' &&
560-
static_cast<uint>(psz[1] - '0') <= 1)
558+
if (*psz == '_' && isNumericSeparatorEnabled && pszSave < psz && psz[-1] == '0' && static_cast<uint>(psz[1] - '0') <= 1)
561559
{
562560
psz++;
563561
goto LSkipZeroes;
@@ -566,6 +564,7 @@ using namespace Js;
566564
*ppchLim = psz;
567565
return dbl;
568566
}
567+
569568
//Now that leading zeros are skipped first bit should be one so lets
570569
//go ahead and count it and increment psz
571570
cbit = 1;
@@ -583,7 +582,7 @@ using namespace Js;
583582
const uint leftShiftValue = 52;
584583

585584
LGetBinaryDigit:
586-
uT = (*psz - '0');
585+
uT = *psz - '0';
587586
if (uT <= 1)
588587
{
589588
if (cbit <= rightShiftValue)
@@ -609,7 +608,7 @@ using namespace Js;
609608
}
610609
else if (*psz == '_')
611610
{
612-
if (isNumericSeparatorEnabled && cbit > 0 && static_cast<uint>(psz[1] - '0') <= 1 && static_cast<uint>(psz[-1] - '0') <= 1)
611+
if (isNumericSeparatorEnabled && cbit > 0 && psz[-1] != '_' && static_cast<uint>(psz[1] - '0') <= 1)
613612
{
614613
psz++;
615614
goto LGetBinaryDigit;

0 commit comments

Comments
 (0)