Re: [PATCH v2] uapi: Revert "bitops: avoid integer overflow in GENMASK(_ULL)"
From: I Hsin Cheng
Date: Sun Feb 23 2025 - 14:06:45 EST
On Sat, Feb 22, 2025 at 09:11:28AM +0000, David Laight wrote:
> 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
Hi David,
> 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.
No problem, I'll run some tests againsts it and let you know in the next
iteration, thanks for your suggestion!
Let's leave this thread here first since it's too large.
Best regards,
I Hsin Cheng.