Lines Matching +full:value +full:- +full:start
1 /* SPDX-License-Identifier: GPL-2.0 */
23 * specific are in various include/asm-<arch>/bitops.h headers
36 * compile-time and at most BITS_PER_LONG.
78 * bitmap_get_value8(map, start) Get 8bit value from map at start
79 * bitmap_set_value8(map, value, start) Set 8bit value to map at start
97 * test_and_set_bit(bit, addr) Set bit and return old value
98 * test_and_clear_bit(bit, addr) Clear bit and return old value
99 * test_and_change_bit(bit, addr) Change bit and return old value
115 * contain all bit positions from 0 to 'bits' - 1.
170 void __bitmap_set(unsigned long *map, unsigned int start, int len);
171 void __bitmap_clear(unsigned long *map, unsigned int start, int len);
175 unsigned long start,
181 * bitmap_find_next_zero_area - find a contiguous aligned zero area
184 * @start: The bitnumber to start searching at
195 unsigned long start, in bitmap_find_next_zero_area() argument
199 return bitmap_find_next_zero_area_off(map, size, start, nr, in bitmap_find_next_zero_area()
237 #define BITMAP_FIRST_WORD_MASK(start) (~0UL << ((start) & (BITS_PER_LONG - 1))) argument
238 #define BITMAP_LAST_WORD_MASK(nbits) (~0UL >> (-(nbits) & (BITS_PER_LONG - 1)))
283 * On 32-bit systems bitmaps are represented as u32 arrays internally. On LE64
287 * to out-of-bound access. To avoid that, both LE and BE variants of 64-bit
305 * On 64-bit systems bitmaps are represented as u64 arrays internally. So,
366 #define BITMAP_MEM_MASK (BITMAP_MEM_ALIGNMENT - 1)
380 * bitmap_or_equal - Check whether the or of two bitmaps is equal to a third
451 static __always_inline void bitmap_set(unsigned long *map, unsigned int start, in bitmap_set() argument
455 __set_bit(start, map); in bitmap_set()
456 else if (small_const_nbits(start + nbits)) in bitmap_set()
457 *map |= GENMASK(start + nbits - 1, start); in bitmap_set()
458 else if (__builtin_constant_p(start & BITMAP_MEM_MASK) && in bitmap_set()
459 IS_ALIGNED(start, BITMAP_MEM_ALIGNMENT) && in bitmap_set()
462 memset((char *)map + start / 8, 0xff, nbits / 8); in bitmap_set()
464 __bitmap_set(map, start, nbits); in bitmap_set()
467 static __always_inline void bitmap_clear(unsigned long *map, unsigned int start, in bitmap_clear() argument
471 __clear_bit(start, map); in bitmap_clear()
472 else if (small_const_nbits(start + nbits)) in bitmap_clear()
473 *map &= ~GENMASK(start + nbits - 1, start); in bitmap_clear()
474 else if (__builtin_constant_p(start & BITMAP_MEM_MASK) && in bitmap_clear()
475 IS_ALIGNED(start, BITMAP_MEM_ALIGNMENT) && in bitmap_clear()
478 memset((char *)map + start / 8, 0, nbits / 8); in bitmap_clear()
480 __bitmap_clear(map, start, nbits); in bitmap_clear()
522 * BITMAP_FROM_U64() - Represent u64 value in the format suitable for bitmap.
523 * @n: u64 value
525 * Linux bitmaps are internally arrays of unsigned longs, i.e. 32-bit
526 * integers in 32-bit environment, and 64-bit integers in 64-bit one.
531 * On 64-bit kernels 64-bit LE and BE numbers are naturally ordered in
534 * On 32-bit kernels 32-bit LE ABI orders lo word of 64-bit number in memory
535 * prior to hi, and 32-bit BE orders hi word prior to lo. The bitmap on the
536 * other hand is represented as an array of 32-bit words and the position of
539 * It matches 32-bit LE ABI, and we can simply let the compiler store 64-bit
555 * bitmap_from_u64 - Check and swap words within u64.
559 * In 32-bit Big Endian kernel, when using ``(u32 *)(&val)[*]``
562 * but we expect the lower 32-bits of u64.
570 * bitmap_get_value8 - get an 8-bit value within a memory region
572 * @start: bit offset of the 8-bit value; must be a multiple of 8
574 * Returns the 8-bit value located at the @start bit offset within the @src
578 unsigned long start) in bitmap_get_value8() argument
580 const size_t index = BIT_WORD(start); in bitmap_get_value8()
581 const unsigned long offset = start % BITS_PER_LONG; in bitmap_get_value8()
587 * bitmap_set_value8 - set an 8-bit value within a memory region
589 * @value: the 8-bit value; values wider than 8 bits may clobber bitmap
590 * @start: bit offset of the 8-bit value; must be a multiple of 8
592 static inline void bitmap_set_value8(unsigned long *map, unsigned long value, in bitmap_set_value8() argument
593 unsigned long start) in bitmap_set_value8() argument
595 const size_t index = BIT_WORD(start); in bitmap_set_value8()
596 const unsigned long offset = start % BITS_PER_LONG; in bitmap_set_value8()
599 map[index] |= value << offset; in bitmap_set_value8()