There are a few comparisons in combination with bitwise operators. Since these operators have lower precedence than the e.g. ==, the code may not do what was indended by the author
I suggest to place parentheses even if the expression is evaluated as intended.
The line numbers are a bit off, but I linked to the correct lines in this repository.
src/abycore/sharing/yaoserversharing.cpp:827:53: warning: ^ has lower precedence than ==; == will be evaluated first [-Wparentheses]
if (m_vClientROTRcvBuf.GetBitNoMask(linbitctr) ^ permval == 1) {
^~~~~~~~~~~~~~
src/abycore/sharing/yaoserversharing.cpp:827:53: note: place parentheses around the '==' expression to silence this warning
if (m_vClientROTRcvBuf.GetBitNoMask(linbitctr) ^ permval == 1) {
^
( )
src/abycore/sharing/yaoserversharing.cpp:827:53: note: place parentheses around the ^ expression to evaluate it first
if (m_vClientROTRcvBuf.GetBitNoMask(linbitctr) ^ permval == 1) {
^
( )
src/examples/psi_phasing/common/phasing_circuit.cpp:287:9: warning: & has lower precedence than >; > will be
evaluated first [-Wparentheses]
if(j & 0x01 > 0) { //value is odd, hence store highest value on stash
^~~~~~~~~~
src/examples/psi_phasing/common/phasing_circuit.cpp:287:9: note: place parentheses around the '>' expression to silence this warning
if(j & 0x01 > 0) { //value is odd, hence store highest value on stash
^
( )
src/examples/psi_phasing/common/phasing_circuit.cpp:287:9: note: place parentheses around the & expression to evaluate it first
if(j & 0x01 > 0) { //value is odd, hence store highest value on stash
^
( )
src/test/abytest.cpp:177:17: warning: ^ has lower precedence than ==; == will be evaluated first [-Wparentheses]
verify = sa ^ sb == 0 ? b : a;
^~~~~~~~~
src/test/abytest.cpp:177:17: note: place parentheses around the '==' expression to silence this warning
verify = sa ^ sb == 0 ? b : a;
^
( )
abytest.cpp:177:17: note: place parentheses around the ^ expression to evaluate it first
verify = sa ^ sb == 0 ? b : a;
^
( )
There are a few comparisons in combination with bitwise operators. Since these operators have lower precedence than the e.g.
==
, the code may not do what was indended by the authorI suggest to place parentheses even if the expression is evaluated as intended.
The line numbers are a bit off, but I linked to the correct lines in this repository.
here
here
here
here