Re: [PATCH 4/7] minmax: Simplify signedness check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 24 Jul 2024 at 09:49, Arnd Bergmann <arnd@xxxxxxxxxx> wrote:
>
> I don't understand why this return '0' for unsigned types,
> shouldn't this be
>
> ((is_unsigned_type(typeof(x)) ? 1 : __if_constexpr(x, (x) + 0, -1)) >= 0)

Yes, that looks more logical.

Plus why do that "__if_constexpr(x, (x) + 0, -1)) >= 0)" when it would
appear to be more logical to move the comparison inside, ie

  __if_constexpr(x, (x) >= 0, 0)

but I also don't see why that "+ 0" existed in the original. So
there's presumably something I'm missing.

I do get the feeling that the problem came from us being much too
clever with out min/max macros, and now this series is  doubling down
instead of saying "it wasn't really worth it".

              Linus




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux