Re: [PATCH v2] uapi: Revert "bitops: avoid integer overflow in GENMASK(_ULL)"

From: David Laight
Date: Sat Feb 22 2025 - 04:11:38 EST


On Fri, 21 Feb 2025 15:41:49 +0800
I Hsin Cheng <richard120310@xxxxxxxxx> wrote:

> This patch reverts 'commit c32ee3d9abd2("bitops: avoid integer overflow in
> GENMASK(_ULL)")'.
>
> The code generation can be shrink by over 1k by reverting the commit.

While you are setup for testing this (and me being lazy) does changing
the definition to be:
(2u << hi) - (1u << lo)
make it any smaller.

(A summary of the size summary would do, no point listing lots of '-1')

That can also be written:
((one + one) << hi) - (one << lo)
so an appropriately typed 'one' (1, 1u, 1ul, 1ull, (__uint128)1 etc) can
be passed.

David