Enable 128-bit arithmetic if __int128 is available
This commit is contained in:
parent
347464d3fd
commit
eb8119d65c
13
configure.ac
13
configure.ac
@ -446,21 +446,26 @@ AC_SUBST(HAVE_AVX_ASM_V)
|
||||
AC_MSG_CHECKING(for 128-bit arithmetic)
|
||||
HAVE_TI_MODE_V=0
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||
#ifndef __GNUC__
|
||||
# error mode(TI) is a gcc extension
|
||||
#if !defined(__GNUC__) && !defined(__SIZEOF_INT128__)
|
||||
# error mode(TI) is a gcc extension, and __int128 is not available
|
||||
#endif
|
||||
#if defined(__clang__) && !defined(__x86_64__)
|
||||
# error clang does not properly compile smult_curve25519_donna_c64.c
|
||||
# error clang does not properly handle the 128-bit type on 32-bit systems
|
||||
#endif
|
||||
#ifndef NATIVE_LITTLE_ENDIAN
|
||||
# error donna_c64 currently requires a little endian CPU
|
||||
# error libsodium currently expects a little endian CPU for the 128-bit type
|
||||
#endif
|
||||
#ifdef __EMSCRIPTEN__
|
||||
# error emscripten currently supports only shift operations on integers \
|
||||
# larger than 64 bits
|
||||
#endif
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#if defined(__SIZEOF_INT128__)
|
||||
typedef unsigned __int128 uint128_t;
|
||||
#else
|
||||
typedef unsigned uint128_t __attribute__((mode(TI)));
|
||||
#endif
|
||||
void fcontract(uint128_t *t) {
|
||||
*t += 0x8000000000000 - 1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user