Lines Matching +full:function +full:- +full:mask
1 /* SPDX-License-Identifier: BSD-3-Clause */
53 #define BITS_TO_CHUNKS(sz) (((sz) + BITS_PER_CHUNK - 1) / BITS_PER_CHUNK)
57 #define LAST_CHUNK_BITS(nr) ((((nr) - 1) % BITS_PER_CHUNK) + 1)
60 (BITS_PER_CHUNK - LAST_CHUNK_BITS(nr)))
80 * and define macro ICE_ATOMIC_BITOPS to overwrite the default non-atomic
113 * ice_is_bit_set - Check state of a bit in a bitmap
127 * ice_clear_bit - Clear a bit in a bitmap
140 * ice_set_bit - Set a bit in a bitmap
153 * ice_test_and_clear_bit - Atomically clear a bit and return the old bit value
168 * ice_test_and_set_bit - Atomically set a bit and return the old bit value
182 /* ice_zero_bitmap - set bits of bitmap to zero.
186 * Set all of the bits in a bitmap to zero. Note that this function assumes it
198 * ice_and_bitmap - bitwise AND 2 bitmaps and store result in dst bitmap
204 * This function performs a bitwise AND on two "source" bitmaps of the same size
206 * size as the "source" bitmaps to avoid buffer overflows. This function returns
207 * a non-zero value if at least one bit location from both "source" bitmaps is
208 * non-zero.
214 ice_bitmap_t res = 0, mask;
218 for (i = 0; i < BITS_TO_CHUNKS(size) - 1; i++) {
229 mask = LAST_CHUNK_MASK(size);
230 dst[i] = (dst[i] & ~mask) | ((bmp1[i] & bmp2[i]) & mask);
231 res |= dst[i] & mask;
237 * ice_or_bitmap - bitwise OR 2 bitmaps and store result in dst bitmap
243 * This function performs a bitwise OR on two "source" bitmaps of the same size
251 ice_bitmap_t mask;
255 for (i = 0; i < BITS_TO_CHUNKS(size) - 1; i++)
263 mask = LAST_CHUNK_MASK(size);
264 dst[i] = (dst[i] & ~mask) | ((bmp1[i] | bmp2[i]) & mask);
268 * ice_xor_bitmap - bitwise XOR 2 bitmaps and store result in dst bitmap
274 * This function performs a bitwise XOR on two "source" bitmaps of the same size
282 ice_bitmap_t mask;
286 for (i = 0; i < BITS_TO_CHUNKS(size) - 1; i++)
294 mask = LAST_CHUNK_MASK(size);
295 dst[i] = (dst[i] & ~mask) | ((bmp1[i] ^ bmp2[i]) & mask);
299 * ice_andnot_bitmap - bitwise ANDNOT 2 bitmaps and result in dst bitmap
305 * This function performs a bitwise ANDNOT on two "source" bitmaps of the same
313 ice_bitmap_t mask;
317 for (i = 0; i < BITS_TO_CHUNKS(size) - 1; i++)
325 mask = LAST_CHUNK_MASK(size);
326 dst[i] = (dst[i] & ~mask) | ((bmp1[i] & ~bmp2[i]) & mask);
330 * ice_find_next_bit - Find the index of the next set bit of a bitmap
374 * ice_find_first_bit - Find the index of the first set bit of a bitmap
392 * ice_is_any_bit_set - Return true of any bit in the bitmap is set
405 * ice_cp_bitmap - copy bitmaps
410 * This function copy bitmap from src to dst. Note that this function assumes
421 * ice_bitmap_set - set a number of bits in bitmap from a starting position
426 * This function sets bits in a bitmap from pos to (pos + num_bits) - 1.
427 * Note that this function assumes it is operating on a bitmap declared using
440 * ice_bitmap_hweight - hamming weight of bitmap
444 * This function determines the number of set bits in a bitmap.
445 * Note that this function assumes it is operating on a bitmap declared using
463 * ice_cmp_bitmap - compares two bitmaps
468 * This function compares two bitmaps, and returns result as true or false.
473 ice_bitmap_t mask;
477 for (i = 0; i < BITS_TO_CHUNKS(size) - 1; i++)
482 mask = LAST_CHUNK_MASK(size);
483 if ((bmp1[i] & mask) != (bmp2[i] & mask))
490 * ice_bitmap_from_array32 - copies u32 array source into bitmap destination
495 * This function copies the src bitmap stored in an u32 array into the dst