xref: /freebsd/sys/compat/linuxkpi/common/include/linux/bits.h (revision 592ae60e2b2eff6c2ec467c34be9a457ce24b044)
1 /*
2  * SPDX-License-Identifier: BSD-2-Clause
3  *
4  * Copyright (c) 2016 Kip Macy
5  * Copyright (c) 2018 Johannes Lundberg
6  */
7 
8 #ifndef _LINUXKPI_LINUX_BITS_H_
9 #define	_LINUXKPI_LINUX_BITS_H_
10 
11 #include <linux/bitops.h>
12 
13 #define	GENMASK(h, l)		(((~0UL) >> (BITS_PER_LONG - (h) - 1)) & ((~0UL) << (l)))
14 #define	GENMASK_ULL(h, l)	(((~0ULL) >> (BITS_PER_LONG_LONG - (h) - 1)) & ((~0ULL) << (l)))
15 
16 #endif /* _LINUXKPI_LINUX_BITS_H_ */
17