Reorder checks

This commit is contained in:
Dmitry-Me 2015-02-16 12:11:13 +03:00
parent 77a9822a97
commit 56747e4af9
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;