Projectitis
Well-known member
Hi all,
I have the a few calculations like the following:
I get a -Wsequence-point operation error because the compiler cannot guarantee that the operations are done in this exact order above, which affects the result.
Is there a compiler directive (or something similar) to tell the compiler to follow this exact order, or do I have to break these up and trust the compiler to optimise? e.g.:
I have the a few calculations like the following:
Code:
c = (*p++ << 14) | ((*p << 6) & 0b0011100000000000) | ((*p++ << 7) & 0b0000011110000000) | ((*p >> 1) & 0b0000000001111111);
Is there a compiler directive (or something similar) to tell the compiler to follow this exact order, or do I have to break these up and trust the compiler to optimise? e.g.:
Code:
c = (*p++ << 14);
c |= ((*p << 6) & 0b0011100000000000);
c |= ((*p++ << 7) & 0b0000011110000000);
c |= ((*p >> 1) & 0b0000000001111111);