Related to the previous commit:

Use bit operator '&' instead of modulo operator '%'.
This commit is contained in:
Edoardo Prezioso 2013-01-04 14:20:15 +01:00
parent 1c0c0471df
commit c465cf4ab4
1 changed files with 3 additions and 3 deletions

View File

@ -9352,12 +9352,12 @@ void Tokenizer::simplifyMathExpressions()
//Pythagorean trigonometric identity: pow(sin(x),2n)+pow(cos(x),2n) = 1
//Hyperbolic identity: pow(sinh(x),2n)-pow(cosh(x),2n) = -1
//2n = any number which is multiple of 2
//2n = any even number
if (Token::simpleMatch(tok, "pow (")) {
if (Token::simpleMatch(tok->tokAt(2), "sin (")) {
Token *tok2 = tok->linkAt(3);
if (!Token::Match(tok2, ") , %num% ) + pow ( cos (") ||
MathLib::toLongNumber(tok2->strAt(2)) % 2 != 0)
(MathLib::toLongNumber(tok2->strAt(2)) & 1) == 1)
continue;
Token *tok3 = tok2->tokAt(8);
if (!Token::Match(tok3->link(), ") , %num% )") ||
@ -9370,7 +9370,7 @@ void Tokenizer::simplifyMathExpressions()
} else if (Token::simpleMatch(tok->tokAt(2), "sinh (")) {
Token *tok2 = tok->linkAt(3);
if (!Token::Match(tok2, ") , %num% ) - pow ( cosh (") ||
MathLib::toLongNumber(tok2->strAt(2)) % 2 != 0)
(MathLib::toLongNumber(tok2->strAt(2)) & 1) == 1)
continue;
Token *tok3 = tok2->tokAt(8);
if (!Token::Match(tok3->link(), ") , %num% )") ||