mratsim / constantine

Constantine: modular, high-performance, zero-dependency cryptography stack for verifiable computation, proof systems and blockchain protocols.
Other
413 stars 44 forks source link

fix(gcc): compatibility with GCC14 #435

Closed mratsim closed 4 months ago

mratsim commented 4 months ago

GCC 14 made passing an "incompatible" pointer type to another function an error.

The issue comes from builtin add-carry and sub-borrow. Nim uint64 maps to NU64 which itself maps to uint64_t which itself maps to long unsigned int on x86-64.

However _addcarry_u64 has for signature unsigned char _addcarry_u64 (unsigned char c_in, unsigned __int64 a, unsigned __int64 b, unsigned __int64 * out)

unsigned __int64 maps to unsigned long long which is deemed incompatible with uint64_t so we need an explicit cast.