math/f25519.c: Implementation for arithmetic in GF(2^255 - 19).
[catacomb] / configure.ac
index 6171efd..bd2c3b5 100644 (file)
@@ -307,6 +307,21 @@ fi
 catacomb_LIMIT([SIZET],                [=0],           [~(size_t)0])
 AC_SUBST([limits])
 
+dnl Figure out other aspects of the implementation's arithmetic.
+AC_CACHE_CHECK([whether negative numbers use two's complement],
+       [catacomb_cv_neg_twoc],
+[AC_TRY_COMPILE(
+[#include <limits.h>],
+[int check[2*!!(-INT_MAX == INT_MIN + 1) - 1];],
+[catacomb_cv_neg_twoc=yes],
+[catacomb_cv_neg_twoc=no])])
+case $catacomb_cv_neg_twoc in
+  yes)
+    AC_DEFINE([NEG_TWOC], [1],
+     [Define if signed numbers are represented in two's complement.])
+    ;;
+esac
+
 dnl Functions used for noise-gathering.
 AC_CHECK_FUNCS([setgroups])
 AC_CHECK_HEADERS([linux/random.h])