Re: Somewhat Puzzline Error

From: Warner Losh <imp_at_bsdimp.com>
Date: Wed, 14 May 2025 23:39:07 UTC
On Wed, May 14, 2025, 5:23 PM Cy Schubert <Cy.Schubert@cschubert.com> wrote:

> On 32-bit platforms, given this definition,
>
> typedef uint128_t fiat_25519_uint128;
>
> The following should be ok.
>
>   fiat_25519_uint128 x26 = (x25 + (x10 + (x9 + (x7 + x4))));
>   uint64_t x27 = (uint64_t)(x26 >> 51);
>
> But on 32-bit platforms only this results in the following error.
>
> In file included from
> /home/cy/src-krb5/crypto/krb5/src/plugins/preauth/spake/ed
> wards25519.c:193:
>
> /home/cy/src-krb5/crypto/krb5/src/plugins/preauth/spake/edwards25519_fiat.h:101:
> 33: error: shift count >= width of type [-Werror,-Wshift-count-overflow]
>   101 |   uint64_t x27 = (uint64_t)(x26 >> 51);
>       |                                 ^  ~~
> x26 should be 128 bits. Or is uint128_t not 128 bits on 32-bit platforms?
>
> Of course there is no error on 64-bit platforms.
>

There may be a hack for that sonce __int128_t didn't work on i386. But that
was confined to nvmecontrol i though. I don't see where we define
uint128_t...

Warner

-- 
> Cheers,
> Cy Schubert <Cy.Schubert@cschubert.com>
> FreeBSD UNIX:  <cy@FreeBSD.org>   Web:  https://FreeBSD.org
> NTP:           <cy@nwtime.org>    Web:  https://nwtime.org
>
>                         e^(i*pi)+1=0
>
>
>