Clarify expressions with parentheses

This commit is contained in:
Dmitry-Me 2017-10-18 23:40:43 +03:00
parent e356ccca22
commit 8709490903
1 changed files with 4 additions and 4 deletions

View File

@ -481,9 +481,9 @@ static void setTokenValue(Token* tok, const ValueFlow::Value &value, const Setti
if (!f && !value1->isIntValue() && !value2->isIntValue())
break;
if (parent->str() == ">")
result.intvalue = f ? floatValue1 > floatValue2 : value1->intvalue > value2->intvalue;
result.intvalue = f ? (floatValue1 > floatValue2) : (value1->intvalue > value2->intvalue);
else if (parent->str() == ">=")
result.intvalue = f ? floatValue1 >= floatValue2 : value1->intvalue >= value2->intvalue;
result.intvalue = f ? (floatValue1 >= floatValue2) : (value1->intvalue >= value2->intvalue);
else if (!f && parent->str() == ">>" && value1->intvalue >= 0 && value2->intvalue >= 0 && value2->intvalue < 64)
result.intvalue = value1->intvalue >> value2->intvalue;
else
@ -496,9 +496,9 @@ static void setTokenValue(Token* tok, const ValueFlow::Value &value, const Setti
if (!f && !value1->isIntValue() && !value2->isIntValue())
break;
if (parent->str() == "<")
result.intvalue = f ? floatValue1 < floatValue2 : value1->intvalue < value2->intvalue;
result.intvalue = f ? (floatValue1 < floatValue2) : (value1->intvalue < value2->intvalue);
else if (parent->str() == "<=")
result.intvalue = f ? floatValue1 <= floatValue2 : value1->intvalue <= value2->intvalue;
result.intvalue = f ? (floatValue1 <= floatValue2) : (value1->intvalue <= value2->intvalue);
else if (!f && parent->str() == "<<" && value1->intvalue >= 0 && value2->intvalue >= 0 && value2->intvalue < 64)
result.intvalue = value1->intvalue << value2->intvalue;
else