Lines Matching refs:x
51 #define BITSET_COPY(x, y) memcpy( (x), (y), sizeof (x) ) argument
52 #define BITSET_EQUAL(x, y) (memcmp( (x), (y), sizeof (x) ) == 0) argument
53 #define BITSET_ZERO(x) memset( (x), 0, sizeof (x) ) argument
54 #define BITSET_ONES(x) memset( (x), 0xff, sizeof (x) ) argument
55 #define BITSET_SIZE(x) (8 * sizeof(x)) // bitset size in bits argument
62 #define BITSET_TEST(x, b) (((x)[BITSET_BITWORD(b)] & BITSET_BIT(b)) != 0) argument
63 #define BITSET_SET(x, b) ((x)[BITSET_BITWORD(b)] |= BITSET_BIT(b)) argument
64 #define BITSET_CLEAR(x, b) ((x)[BITSET_BITWORD(b)] &= ~BITSET_BIT(b)) argument
72 __bitset_and(BITSET_WORD *r, const BITSET_WORD *x, const BITSET_WORD *y, unsigned n) in __bitset_and() argument
75 r[i] = x[i] & y[i]; in __bitset_and()
79 __bitset_or(BITSET_WORD *r, const BITSET_WORD *x, const BITSET_WORD *y, unsigned n) in __bitset_or() argument
82 r[i] = x[i] | y[i]; in __bitset_or()
86 __bitset_not(BITSET_WORD *x, unsigned n) in __bitset_not() argument
89 x[i] = ~x[i]; in __bitset_not()
93 __bitset_andnot(BITSET_WORD *r, const BITSET_WORD *x, const BITSET_WORD *y, unsigned n) in __bitset_andnot() argument
96 r[i] = x[i] & ~y[i]; in __bitset_andnot()
99 #define BITSET_AND(r, x, y) \ argument
101 STATIC_ASSERT(ARRAY_SIZE(r) == ARRAY_SIZE(x)); \
103 __bitset_and(r, x, y, ARRAY_SIZE(r)); \
106 #define BITSET_OR(r, x, y) \ argument
108 STATIC_ASSERT(ARRAY_SIZE(r) == ARRAY_SIZE(x)); \
110 __bitset_or(r, x, y, ARRAY_SIZE(r)); \
113 #define BITSET_NOT(x) \ argument
114 __bitset_not(x, ARRAY_SIZE(x))
116 #define BITSET_ANDNOT(r, x, y) \ argument
118 assert(ARRAY_SIZE(r) == ARRAY_SIZE(x)); \
120 __bitset_andnot(r, x, y, ARRAY_SIZE(r)); \
124 __bitset_rotate_right(BITSET_WORD *x, unsigned amount, unsigned n) in __bitset_rotate_right() argument
132 x[i] = (x[i] >> amount) | (x[i + 1] << (BITSET_WORDBITS - amount)); in __bitset_rotate_right()
135 x[n - 1] = x[n - 1] >> amount; in __bitset_rotate_right()
139 __bitset_rotate_left(BITSET_WORD *x, unsigned amount, unsigned n) in __bitset_rotate_left() argument
147 x[i] = (x[i] << amount) | (x[i - 1] >> (BITSET_WORDBITS - amount)); in __bitset_rotate_left()
150 x[0] = x[0] << amount; in __bitset_rotate_left()
154 __bitset_shr(BITSET_WORD *x, unsigned amount, unsigned n) in __bitset_shr() argument
165 x[i] = x[i + words]; in __bitset_shr()
168 x[i++] = 0; in __bitset_shr()
173 __bitset_rotate_right(x, amount, n); in __bitset_shr()
178 __bitset_shl(BITSET_WORD *x, unsigned amount, unsigned n) in __bitset_shl() argument
189 x[i] = x[i - words]; in __bitset_shl()
193 x[i--] = 0; in __bitset_shl()
199 __bitset_rotate_left(x, amount, n); in __bitset_shl()
202 #define BITSET_SHR(x, n) \ argument
203 __bitset_shr(x, n, ARRAY_SIZE(x));
205 #define BITSET_SHL(x, n) \ argument
206 __bitset_shl(x, n, ARRAY_SIZE(x));
210 #define BITSET_TEST_RANGE_INSIDE_WORD(x, b, e) \ argument
212 (((x)[BITSET_BITWORD(b)] & BITSET_RANGE(b, e)) != 0) : \
214 #define BITSET_SET_RANGE_INSIDE_WORD(x, b, e) \ argument
216 ((x)[BITSET_BITWORD(b)] |= BITSET_RANGE(b, e)) : \
218 #define BITSET_CLEAR_RANGE_INSIDE_WORD(x, b, e) \ argument
220 ((x)[BITSET_BITWORD(b)] &= ~BITSET_RANGE(b, e)) : \
239 #define BITSET_TEST_RANGE(x, b, e) \ argument
240 __bitset_test_range(x, b, e)
258 #define BITSET_SET_RANGE(x, b, e) \ argument
259 __bitset_set_range(x, b, e)
277 #define BITSET_CLEAR_RANGE(x, b, e) \ argument
278 __bitclear_clear_range(x, b, e)
281 __bitset_prefix_sum(const BITSET_WORD *x, unsigned b, unsigned n) in __bitset_prefix_sum() argument
287 prefix += util_bitcount(x[i]); in __bitset_prefix_sum()
289 prefix += util_bitcount(x[i] & BITFIELD_MASK(b - i * BITSET_WORDBITS)); in __bitset_prefix_sum()
302 __bitset_count(const BITSET_WORD *x, unsigned n) in __bitset_count() argument
304 return __bitset_prefix_sum(x, ~0, n); in __bitset_count()
307 #define BITSET_PREFIX_SUM(x, b) \ argument
308 __bitset_prefix_sum(x, b, ARRAY_SIZE(x))
310 #define BITSET_COUNT(x) \ argument
311 __bitset_count(x, ARRAY_SIZE(x))
316 __bitset_is_empty(const BITSET_WORD *x, int n) in __bitset_is_empty() argument
319 if (x[i]) in __bitset_is_empty()
329 __bitset_ffs(const BITSET_WORD *x, int n) in __bitset_ffs() argument
332 if (x[i]) in __bitset_ffs()
333 return ffs(x[i]) + BITSET_WORDBITS * i; in __bitset_ffs()
342 __bitset_last_bit(const BITSET_WORD *x, int n) in __bitset_last_bit() argument
345 if (x[i]) in __bitset_last_bit()
346 return util_last_bit(x[i]) + BITSET_WORDBITS * i; in __bitset_last_bit()
352 #define BITSET_FFS(x) __bitset_ffs(x, ARRAY_SIZE(x)) argument
353 #define BITSET_LAST_BIT(x) __bitset_last_bit(x, ARRAY_SIZE(x)) argument
354 #define BITSET_LAST_BIT_SIZED(x, size) __bitset_last_bit(x, size) argument
355 #define BITSET_IS_EMPTY(x) __bitset_is_empty(x, ARRAY_SIZE(x)) argument
487 operator=(int x) \
489 const T c = {{ (BITSET_WORD)x }}; \
506 operator==(const T &b, int x) \
508 const T c = {{ (BITSET_WORD)x }}; \
513 operator!=(const T &b, int x) \
515 return !(b == x); \