On 11/05/2014 05:44 PM, Peter Zijlstra wrote:
On Wed, Nov 05, 2014 at 04:47:14PM +0100, Maxime Coquelin wrote:
On 11/05/2014 12:10 PM, Rasmus Villemoes wrote:
On Tue, Nov 04 2014, Maxime COQUELIN wrote:
-#define GENMASK(h, l) (((U32_C(1) << ((h) - (l) + 1)) - 1) << (l))
-#define GE
On Wed, Nov 05, 2014 at 04:47:14PM +0100, Maxime Coquelin wrote:
>
> On 11/05/2014 12:10 PM, Rasmus Villemoes wrote:
> >On Tue, Nov 04 2014, Maxime COQUELIN wrote:
> >
> >>-#define GENMASK(h, l) (((U32_C(1) << ((h) - (l) + 1)) - 1) <<
> >>(l))
> >>-#define GENMASK_ULL(h, l) (((U64_
On 11/05/2014 12:10 PM, Rasmus Villemoes wrote:
On Tue, Nov 04 2014, Maxime COQUELIN wrote:
-#define GENMASK(h, l) (((U32_C(1) << ((h) - (l) + 1)) - 1) << (l))
-#define GENMASK_ULL(h, l) (((U64_C(1) << ((h) - (l) + 1)) - 1) << (l))
+#define GENMASK(h, l) \
+ ((~0UL >> (BIT
On Tue, Nov 04 2014, Maxime COQUELIN wrote:
> -#define GENMASK(h, l)(((U32_C(1) << ((h) - (l) + 1)) - 1) <<
> (l))
> -#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))
On Tue, Nov 04, 2014 at 11:58:17AM +0100, Maxime COQUELIN wrote:
> On some 32 bits architectures, including x86, GENMASK(31, 0) returns 0
> instead of the expected ~0UL.
>
> This is the same on some 64 bits architectures with GENMASK_ULL(63, 0).
>
> This is due to an overflow in the shift operand
On some 32 bits architectures, including x86, GENMASK(31, 0) returns 0
instead of the expected ~0UL.
This is the same on some 64 bits architectures with GENMASK_ULL(63, 0).
This is due to an overflow in the shift operand, 1 << 32 for GENMASK,
1 << 64 for GENMASK_ULL.
Fixes: 10ef6b0dffe404bcc54e9
6 matches
Mail list logo