1*ab0c7fb2SPaolo Bonzini /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2*ab0c7fb2SPaolo Bonzini /* bits.h: Macros for dealing with bitmasks.  */
3*ab0c7fb2SPaolo Bonzini 
4*ab0c7fb2SPaolo Bonzini #ifndef _LINUX_BITS_H
5*ab0c7fb2SPaolo Bonzini #define _LINUX_BITS_H
6*ab0c7fb2SPaolo Bonzini 
7*ab0c7fb2SPaolo Bonzini #define __GENMASK(h, l) \
8*ab0c7fb2SPaolo Bonzini         (((~_UL(0)) - (_UL(1) << (l)) + 1) & \
9*ab0c7fb2SPaolo Bonzini          (~_UL(0) >> (__BITS_PER_LONG - 1 - (h))))
10*ab0c7fb2SPaolo Bonzini 
11*ab0c7fb2SPaolo Bonzini #define __GENMASK_ULL(h, l) \
12*ab0c7fb2SPaolo Bonzini         (((~_ULL(0)) - (_ULL(1) << (l)) + 1) & \
13*ab0c7fb2SPaolo Bonzini          (~_ULL(0) >> (__BITS_PER_LONG_LONG - 1 - (h))))
14*ab0c7fb2SPaolo Bonzini 
15*ab0c7fb2SPaolo Bonzini #endif /* _LINUX_BITS_H */
16