ValleyAudio / ValleyRackFree

Modules for VCV Rack
Other
176 stars 24 forks source link

Fix compiler warning in Amalgam.cpp #62

Closed falkTX closed 2 years ago

falkTX commented 2 years ago

Detected by macOS clang.

ValleyAudio/src/Amalgam/Amalgam.cpp:141:46: error: operator '?:' has lower precedence than '&'; '&' will be evaluated first [-Werror,-Wbitwise-conditional-parentheses]
    zAnd = (zOut[0] > 0.f) & (zOut[2] > 0.f) ? 5.f : 0.f;
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
ValleyAudio/src/Amalgam/Amalgam.cpp:141:46: note: place parentheses around the '&' expression to silence this warning
    zAnd = (zOut[0] > 0.f) & (zOut[2] > 0.f) ? 5.f : 0.f;
                                             ^
           (                                )
ValleyAudio/src/Amalgam/Amalgam.cpp:141:46: note: place parentheses around the '?:' expression to evaluate it first
    zAnd = (zOut[0] > 0.f) & (zOut[2] > 0.f) ? 5.f : 0.f;
                                             ^
                             (                          )
falkTX commented 2 years ago

Hi, just updated the PR to rebase against latest changes, also change the commit message to be more clear. This is just to fix a compiler warning, the code itself is fine but compilers complain about it.

ValleyAudio commented 2 years ago

Thank you for that fix :)