I have the following:
#define PAD ( 4 - ( (WIDTH*BPP)%4 ) )
#if PAD == 4
#define PAD 0
#endif
and PAD is redefined even though it is equal to 3 after the first definition. However if I explicitly define it as 3 then it isn’t redefined. Therefore I assume there is a problem with the way I have written the expression, but I’m not sure what.
What you want is
right? (Of course
0 <= PAD < 4)Then you can define
PADin this way:Example Python session:
In general,
makes
PAD + Xa multiple ofNunder a constraint of0 <= PAD < N(Though I didn’t check negative cases…)