8 #define BIT(n) (1 << (n)) 9 #define BITS(n) (BIT(n) - 1) 10 #ifndef BRANCHLESS_BITSET 11 #define BITSET(var, mask, flag) (flag ? (var) | (mask) : (var) & ~(mask)) 13 #define BITSET(var, mask, flag) ((var) ^ (-(flag) ^ (var)) & (mask)) 30 if (!(bits & (bits - 1)))
37 for (
int f = 1; f <= bits; f *= 2)
44 else r = (r - 1) / (n - 1);
54 while (k > 0 && bits != r)
87 int v0 = (e.(fld) & bit);
91 if (val > 0) e.(fld) |= bit;
96 if (val > 0) e.(fld) |= bit;
99 if (val <= 0) e.(fld) &= ~bit;
102 if (val > 0) e.(fld) &= ~bit;
105 int v1 = (e.(fld) & bit);
119 e.(fld) =
max(e.(fld), val);
122 e.(fld) =
min(e.(fld), val);
ERASEABLE int lowestbit(int f)
ERASEABLE int randombit(int bits)
ERASEABLE bool GiveValue(entity e,.int fld, int op, int val)
ERASEABLE int randombits(int bits, int k, bool error_return)
ERASEABLE bool GiveBit(entity e,.int fld, int bit, int op, int val)