Merge pull request #524 from Dmitry-Me/reorderChecks3

Reorder checks
This commit is contained in:
PKEuS 2015-02-16 10:57:56 +01:00
commit 585292df63
1 changed files with 5 additions and 5 deletions

View File

@ -1643,18 +1643,18 @@ void CheckOther::checkCharVariable()
} }
else if (Token::Match(tok, "[&|^]")) { else if (Token::Match(tok, "[&|^]")) {
// Don't care about address-of operator
if (!tok->astOperand2())
continue;
const Token *tok2; const Token *tok2;
if (tok->astOperand1() && astIsSignedChar(tok->astOperand1())) if (tok->astOperand1() && astIsSignedChar(tok->astOperand1()))
tok2 = tok->astOperand2(); tok2 = tok->astOperand2();
else if (tok->astOperand2() && astIsSignedChar(tok->astOperand2())) else if (astIsSignedChar(tok->astOperand2()))
tok2 = tok->astOperand1(); tok2 = tok->astOperand1();
else else
continue; continue;
// Don't care about address-of operator
if (!tok->astOperand2())
continue;
// it's ok with a bitwise and where the other operand is 0xff or less.. // it's ok with a bitwise and where the other operand is 0xff or less..
if (tok->str() == "&" && tok2 && tok2->isNumber() && MathLib::isGreater("0x100", tok2->str())) if (tok->str() == "&" && tok2 && tok2->isNumber() && MathLib::isGreater("0x100", tok2->str()))
continue; continue;