On Tue, Nov 04, 2014 at 11:03:57AM +0100, Maxime COQUELIN wrote:You're right, I should have seen this..
-#define GENMASK(h, l) (((U32_C(1) << ((h) - (l) + 1)) - 1) << (l))OK, so you need to keep the (h) and (l) bits, macro arguments should be
-#define GENMASK_ULL(h, l) (((U64_C(1) << ((h) - (l) + 1)) - 1) << (l))
+#define GENMASK(h, l) ((~0UL >> (BITS_PER_LONG - (h - l + 1))) << l)
+#define GENMASK_ULL(h, l) ((~0ULL >> (BITS_PER_LONG_LONG - (h - l + 1))) << l)
wrapped in seemingly superfluous braces in order to preserve precedence
on expansion.
Not a problem, v3 is coming.
My bad for not explicitly doing that when suggesting the alternative.