On 07/20/2015 04:28 PM, Andrew Morton wrote:
On Mon, 20 Jul 2015 19:57:18 +0200 Rasmus Villemoes <[email protected]> 
wrote:

On Mon, Jul 20 2015, Guenter Roeck <[email protected]> wrote:

So either case ~0l appears to be wrong; it should be ~0ul.

Yes, right-shifting -1 of any type is probably always wrong, as it will
always give -1 again.

Not for unsigned types.

The kernel uses "-1UL" and "-1ULL" quite a lot - it's a convenient way
of saying "all ones, regardless of size".  Also, assigning plain old
"-1" to an unsigned variable will make that variable all-ones
regardless of size.

In this case I expect we could do

        align_mask = -1UL >> (64 - align_order);

-1ul works, at least on x86 (32 and 64 bit).

but I don't know about that 64.  Maybe it should be BITS_PER_LONG?

I think that is going to be in the next version of the patch.

Guenter

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to