Omit unneeded computations
This commit is contained in:
parent
eaadfb3910
commit
5a642ac35e
|
@ -180,9 +180,9 @@ bool CheckCondition::assignIfParseScope(const Token * const assignTok,
|
||||||
}
|
}
|
||||||
if (Token::Match(tok2,"&&|%oror%|( %varid% ==|!= %num% &&|%oror%|)", varid)) {
|
if (Token::Match(tok2,"&&|%oror%|( %varid% ==|!= %num% &&|%oror%|)", varid)) {
|
||||||
const Token *vartok = tok2->next();
|
const Token *vartok = tok2->next();
|
||||||
const std::string& op(vartok->strAt(1));
|
|
||||||
const MathLib::bigint num2 = MathLib::toLongNumber(vartok->strAt(2));
|
const MathLib::bigint num2 = MathLib::toLongNumber(vartok->strAt(2));
|
||||||
if ((num & num2) != ((bitop=='&') ? num2 : num)) {
|
if ((num & num2) != ((bitop=='&') ? num2 : num)) {
|
||||||
|
const std::string& op(vartok->strAt(1));
|
||||||
const bool alwaysTrue = op == "!=";
|
const bool alwaysTrue = op == "!=";
|
||||||
const std::string condition(vartok->str() + op + vartok->strAt(2));
|
const std::string condition(vartok->str() + op + vartok->strAt(2));
|
||||||
assignIfError(assignTok, tok2, condition, alwaysTrue);
|
assignIfError(assignTok, tok2, condition, alwaysTrue);
|
||||||
|
|
Loading…
Reference in New Issue