Quote:
Originally Posted by joaquimandrade
Bugsy you can also do this: (i don't know how to put a % in a macro)
1 << value % 32
|
Yes, either way works. Your method using modulus will make the 0 bitshift occur at 32 instead of 1 like my -1 method.
PHP Code:
#define AddFlag(%1,%2) ( %1 |= ( 1 << (%2 % 32) ) )
#define RemoveFlag(%1,%2) ( %1 &= ~( 1 << (%2 % 32) ) )
#define CheckFlag(%1,%2) ( %1 & ( 1 << (%2 % 32) ) )
__________________