Lines Matching refs:nr

51 #define BIT_CHUNK(nr)		((nr) / BITS_PER_CHUNK)
55 #define BIT_IN_CHUNK(nr) ((nr) % BITS_PER_CHUNK)
56 /* How many bits are valid in the last chunk, assumes nr > 0 */
57 #define LAST_CHUNK_BITS(nr) ((((nr) - 1) % BITS_PER_CHUNK) + 1)
58 /* Generate a bitmask of valid bits in the last chunk, assumes nr > 0 */
59 #define LAST_CHUNK_MASK(nr) (((ice_bitmap_t)~0) >> \
60 (BITS_PER_CHUNK - LAST_CHUNK_BITS(nr)))
65 static inline bool ice_is_bit_set_internal(u16 nr, const ice_bitmap_t *bitmap)
67 return !!(*bitmap & BIT(nr));
83 static inline void ice_clear_bit_internal(u16 nr, ice_bitmap_t *bitmap)
85 *bitmap &= ~BIT(nr);
88 static inline void ice_set_bit_internal(u16 nr, ice_bitmap_t *bitmap)
90 *bitmap |= BIT(nr);
93 static inline bool ice_test_and_clear_bit_internal(u16 nr,
96 if (ice_is_bit_set_internal(nr, bitmap)) {
97 ice_clear_bit_internal(nr, bitmap);
103 static inline bool ice_test_and_set_bit_internal(u16 nr, ice_bitmap_t *bitmap)
105 if (ice_is_bit_set_internal(nr, bitmap))
108 ice_set_bit_internal(nr, bitmap);
115 * @nr: the bit to check
117 * Returns true if bit nr of bitmap is set. False otherwise. Assumes that nr
120 static inline bool ice_is_bit_set(const ice_bitmap_t *bitmap, u16 nr)
122 return ice_is_bit_set_internal(BIT_IN_CHUNK(nr),
123 &bitmap[BIT_CHUNK(nr)]);
129 * @nr: the bit to change
131 * Clears the bit nr in bitmap. Assumes that nr is less than the size of the
134 static inline void ice_clear_bit(u16 nr, ice_bitmap_t *bitmap)
136 ice_clear_bit_internal(BIT_IN_CHUNK(nr), &bitmap[BIT_CHUNK(nr)]);
142 * @nr: the bit to change
144 * Sets the bit nr in bitmap. Assumes that nr is less than the size of the
147 static inline void ice_set_bit(u16 nr, ice_bitmap_t *bitmap)
149 ice_set_bit_internal(BIT_IN_CHUNK(nr), &bitmap[BIT_CHUNK(nr)]);
154 * @nr: the bit to change
157 * Check and clear the bit nr in bitmap. Assumes that nr is less than the size
161 ice_test_and_clear_bit(u16 nr, ice_bitmap_t *bitmap)
163 return ice_test_and_clear_bit_internal(BIT_IN_CHUNK(nr),
164 &bitmap[BIT_CHUNK(nr)]);
169 * @nr: the bit to change
172 * Check and set the bit nr in bitmap. Assumes that nr is less than the size of
176 ice_test_and_set_bit(u16 nr, ice_bitmap_t *bitmap)
178 return ice_test_and_set_bit_internal(BIT_IN_CHUNK(nr),
179 &bitmap[BIT_CHUNK(nr)]);