|
2 | 2 | #ifndef __LINUX_BITS_H
|
3 | 3 | #define __LINUX_BITS_H
|
4 | 4 |
|
5 |
| -#include <linux/const.h> |
6 | 5 | #include <vdso/bits.h>
|
7 | 6 | #include <uapi/linux/bits.h>
|
8 |
| -#include <asm/bitsperlong.h> |
9 | 7 |
|
10 | 8 | #define BIT_MASK(nr) (UL(1) << ((nr) % BITS_PER_LONG))
|
11 | 9 | #define BIT_WORD(nr) ((nr) / BITS_PER_LONG)
|
|
35 | 33 |
|
36 | 34 | #define GENMASK_INPUT_CHECK(h, l) BUILD_BUG_ON_ZERO(const_true((l) > (h)))
|
37 | 35 |
|
38 |
| -#define GENMASK(h, l) \ |
39 |
| - (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l)) |
40 |
| -#define GENMASK_ULL(h, l) \ |
41 |
| - (GENMASK_INPUT_CHECK(h, l) + __GENMASK_ULL(h, l)) |
42 |
| - |
43 | 36 | /*
|
44 | 37 | * Generate a mask for the specified type @t. Additional checks are made to
|
45 | 38 | * guarantee the value returned fits in that type, relying on
|
|
55 | 48 | (type_max(t) << (l) & \
|
56 | 49 | type_max(t) >> (BITS_PER_TYPE(t) - 1 - (h)))))
|
57 | 50 |
|
| 51 | +#define GENMASK(h, l) GENMASK_TYPE(unsigned long, h, l) |
| 52 | +#define GENMASK_ULL(h, l) GENMASK_TYPE(unsigned long long, h, l) |
| 53 | + |
58 | 54 | #define GENMASK_U8(h, l) GENMASK_TYPE(u8, h, l)
|
59 | 55 | #define GENMASK_U16(h, l) GENMASK_TYPE(u16, h, l)
|
60 | 56 | #define GENMASK_U32(h, l) GENMASK_TYPE(u32, h, l)
|
61 | 57 | #define GENMASK_U64(h, l) GENMASK_TYPE(u64, h, l)
|
| 58 | +#define GENMASK_U128(h, l) GENMASK_TYPE(u128, h, l) |
62 | 59 |
|
63 | 60 | /*
|
64 | 61 | * Fixed-type variants of BIT(), with additional checks like GENMASK_TYPE(). The
|
|
89 | 86 |
|
90 | 87 | #endif /* !defined(__ASSEMBLY__) */
|
91 | 88 |
|
92 |
| -#if !defined(__ASSEMBLY__) |
93 |
| -/* |
94 |
| - * Missing asm support |
95 |
| - * |
96 |
| - * __GENMASK_U128() depends on _BIT128() which would not work |
97 |
| - * in the asm code, as it shifts an 'unsigned __int128' data |
98 |
| - * type instead of direct representation of 128 bit constants |
99 |
| - * such as long and unsigned long. The fundamental problem is |
100 |
| - * that a 128 bit constant will get silently truncated by the |
101 |
| - * gcc compiler. |
102 |
| - */ |
103 |
| -#define GENMASK_U128(h, l) \ |
104 |
| - (GENMASK_INPUT_CHECK(h, l) + __GENMASK_U128(h, l)) |
105 |
| -#endif |
106 |
| - |
107 | 89 | #endif /* __LINUX_BITS_H */
|
0 commit comments