Reduce duplication, omit building unneeded string
This commit is contained in:
parent
7d6ef71c4d
commit
696c5b8100
|
@ -182,11 +182,11 @@ bool CheckCondition::assignIfParseScope(const Token * const assignTok,
|
|||
const Token *vartok = tok2->next();
|
||||
const std::string& op(vartok->strAt(1));
|
||||
const MathLib::bigint num2 = MathLib::toLongNumber(vartok->strAt(2));
|
||||
const std::string condition(vartok->str() + op + vartok->strAt(2));
|
||||
if (op == "==" && (num & num2) != ((bitop=='&') ? num2 : num))
|
||||
assignIfError(assignTok, tok2, condition, false);
|
||||
else if (op == "!=" && (num & num2) != ((bitop=='&') ? num2 : num))
|
||||
assignIfError(assignTok, tok2, condition, true);
|
||||
if ((num & num2) != ((bitop=='&') ? num2 : num)) {
|
||||
const bool alwaysTrue = op == "!=";
|
||||
const std::string condition(vartok->str() + op + vartok->strAt(2));
|
||||
assignIfError(assignTok, tok2, condition, alwaysTrue);
|
||||
}
|
||||
}
|
||||
if (Token::Match(tok2, "%varid% %op%", varid) && tok2->next()->isAssignmentOp()) {
|
||||
return true;
|
||||
|
|
Loading…
Reference in New Issue