xref: /qemu/subprojects/libvduse/linux-headers/linux/bits.h (revision 7be29f2f1a3f5b037d27eedbd5df9f441e8c8c16)
1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 /* bits.h: Macros for dealing with bitmasks.  */
3 
4 #ifndef _LINUX_BITS_H
5 #define _LINUX_BITS_H
6 
7 #define __GENMASK(h, l) (((~_UL(0)) << (l)) & (~_UL(0) >> (BITS_PER_LONG - 1 - (h))))
8 
9 #define __GENMASK_ULL(h, l) (((~_ULL(0)) << (l)) & (~_ULL(0) >> (BITS_PER_LONG_LONG - 1 - (h))))
10 
11 #define __GENMASK_U128(h, l) \
12 	((_BIT128((h)) << 1) - (_BIT128(l)))
13 
14 #endif /* _LINUX_BITS_H */
15