My C compiler gave a warning when using unary minus on an unsigned
value, so I fixed the warning by doing a subtraction from 0 instead.
Now I wonder if the current code is equivalent to the original one:
uint32_t a, b; // assume b is initialized and non-zero
a = -b % b; // old code
a = (0-b) % b; // current code
My question is: for the same values of b
will both lines of code yield the same result for a
?