Skip to content

Commit

Permalink
Merged PR 96029: Reduce the scope of a fix to address a perf bug
Browse files Browse the repository at this point in the history
The change to do this got undone by a fullsync issue when it was done in dev3 (https://microsoft.visualstudio.com/_git/os/commit/6933d4be4f827062c7b62b5f694001efc4891162), and in the meanwhile the macros were removed with the 1711 public release branch merge. In order to get everything into the right state, I'm targeting this at the same branch as the 1711 release.
  • Loading branch information
Penguinwizzard committed Dec 1, 2017
1 parent 1649d36 commit 156a58e
Showing 1 changed file with 10 additions and 25 deletions.
35 changes: 10 additions & 25 deletions lib/Parser/Scan.h
Original file line number Diff line number Diff line change
Expand Up @@ -481,14 +481,9 @@ class Scanner : public IScanner, public EncodingPolicy
charcount_t IchMinTok(void) const
{

AssertOrFailFast(m_pchMinTok - m_pchBase >= 0);
AssertOrFailFast(m_pchMinTok - m_pchBase <= LONG_MAX);
if (static_cast<charcount_t>(m_pchMinTok - m_pchBase) < m_cMinTokMultiUnits)
{
AssertMsg(false, "IchMinTok subtraction overflow");
return 0;
}

Assert(m_pchMinTok - m_pchBase >= 0);
Assert(m_pchMinTok - m_pchBase <= LONG_MAX);
Assert(static_cast<charcount_t>(m_pchMinTok - m_pchBase) >= m_cMinTokMultiUnits);
return static_cast<charcount_t>(m_pchMinTok - m_pchBase - m_cMinTokMultiUnits);
}

Expand All @@ -497,15 +492,10 @@ class Scanner : public IScanner, public EncodingPolicy
charcount_t IchLimTok(void) const
{

AssertOrFailFast(m_currentCharacter - m_pchBase >= 0);
AssertOrFailFast(m_currentCharacter - m_pchBase <= LONG_MAX);
if (static_cast<charcount_t>(m_currentCharacter - m_pchBase) < this->m_cMultiUnits)
{
AssertMsg(false, "IchLimTok subtraction overflow");
return 0;
}

return static_cast< charcount_t >(m_currentCharacter - m_pchBase - this->m_cMultiUnits);
Assert(m_currentCharacter - m_pchBase >= 0);
Assert(m_currentCharacter - m_pchBase <= LONG_MAX);
Assert(static_cast<charcount_t>(m_currentCharacter - m_pchBase) >= this->m_cMultiUnits);
return static_cast<charcount_t>(m_currentCharacter - m_pchBase - this->m_cMultiUnits);
}

void SetErrorPosition(charcount_t ichMinError, charcount_t ichLimError)
Expand Down Expand Up @@ -557,14 +547,9 @@ class Scanner : public IScanner, public EncodingPolicy
charcount_t IchMinLine(void) const
{

AssertOrFailFast(m_pchMinLine - m_pchBase >= 0);
AssertOrFailFast(m_pchMinLine - m_pchBase <= LONG_MAX);
if (static_cast<charcount_t>(m_pchMinLine - m_pchBase) < m_cMinLineMultiUnits)
{
AssertMsg(false, "IchMinLine subtraction overflow");
return 0;
}

Assert(m_pchMinLine - m_pchBase >= 0);
Assert(m_pchMinLine - m_pchBase <= LONG_MAX);
Assert(static_cast<charcount_t>(m_pchMinLine - m_pchBase) >= m_cMinLineMultiUnits);
return static_cast<charcount_t>(m_pchMinLine - m_pchBase - m_cMinLineMultiUnits);
}

Expand Down

0 comments on commit 156a58e

Please sign in to comment.