xref: /openbmc/u-boot/include/linux/bitmap.h (revision 1670a154)
1 // SPDX-License-Identifier: GPL-2.0+
2 #ifndef __LINUX_BITMAP_H
3 #define __LINUX_BITMAP_H
4 
5 #include <asm/types.h>
6 #include <linux/types.h>
7 #include <linux/bitops.h>
8 
9 #define small_const_nbits(nbits) \
10 	(__builtin_constant_p(nbits) && (nbits) <= BITS_PER_LONG)
11 
12 static inline void bitmap_zero(unsigned long *dst, int nbits)
13 {
14 	if (small_const_nbits(nbits)) {
15 		*dst = 0UL;
16 	} else {
17 		int len = BITS_TO_LONGS(nbits) * sizeof(unsigned long);
18 
19 		memset(dst, 0, len);
20 	}
21 }
22 
23 #endif /* __LINUX_BITMAP_H */
24