BrunoLevy / TinyPrograms

Tiny programs from various sources, for testing softcores
94 stars 7 forks source link

parentheses error should be fixed. #6

Open fnclovers opened 2 months ago

fnclovers commented 2 months ago

I got this error while compiling raytrace, using riscv-toolchain.

src/raytrace.c:102:76: error: suggest parentheses around arithmetic in operand of '^' [-Werror=parentheses]
  102 |     h->c = s2v(to_fixed( (((h->p.x>>(FP-3)) + g_time) ^ ((h->p.z>>(FP-3))) + g_time) &255));

Must be corrected to h->c = s2v(to_fixed( ((((h->p.x >> (FP-3)) + g_time) ^ ((h->p.z >> (FP-3)) + g_time)) & 255)));.

BrunoLevy commented 2 months ago

Hi, it is a warning, not an error (but you are right, it will be better with the parentheses).