cannonball icon indicating copy to clipboard operation
cannonball copied to clipboard

src/main/engine/ocrash.cpp:863: possible bad expression ?

Open dcb314 opened this issue 2 years ago • 0 comments

New C compiler clang-14 says:

src/main/engine/ocrash.cpp:863:51: warning: operator '?:' has lower precedence than '+'; '+' will be evaluated first [-Wparentheses]

Source code is

slide = ((spins + 1) << 2) + (car_inc > 0xFF) ? 0xFF >> 3 : car_inc >> 3;

Maybe better code:

slide = ((spins + 1) << 2) + ((car_inc > 0xFF) ? 0xFF >> 3 : car_inc >> 3);

dcb314 avatar Apr 20 '22 18:04 dcb314