Re: Somewhat Puzzline Error
- In reply to: Cy Schubert : "Somewhat Puzzline Error"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 15 May 2025 06:08:43 UTC
On 15/05/2025 02:22, Cy Schubert wrote: > On 32-bit platforms, given this definition, > > typedef uint128_t fiat_25519_uint128; I think that 128-bit integer types are a thing only on 64-bit platforms (and perhaps not all of them). I am not sure why compilation does not bail out earlier on 32-bit platforms. The types are provided by a compiler. E.g., https://gcc.gnu.org/onlinedocs/gcc/_005f_005fint128.html Also, https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60846 I imagine that clang is being compatible with gcc. > 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. -- Andriy Gapon