Commit fce429d08bc7207e356e785e3fdaaa89140fedfe

Daniel Mendler 2019-07-24T15:54:01

tommath.h: do not expose limits.h

diff --git a/tommath.h b/tommath.h
index 5af5014..1303509 100644
--- a/tommath.h
+++ b/tommath.h
@@ -6,7 +6,6 @@
 
 #include <stdint.h>
 #include <stddef.h>
-#include <limits.h>
 
 #ifdef LTM_NO_FILE
 #  warning LTM_NO_FILE has been deprecated, use MP_NO_FILE.
@@ -176,10 +175,6 @@ TOOM_SQR_CUTOFF;
 #   define MP_PREC (MP_DEPRECATED_PRAGMA("MP_PREC is an internal macro") PRIVATE_MP_PREC)
 #endif
 
-/* size of comba arrays, should be at least 2 * 2**(BITS_PER_WORD - BITS_PER_DIGIT*2) */
-#define PRIVATE_MP_WARRAY (int)(1uLL << (((CHAR_BIT * sizeof(private_mp_word)) - (2 * MP_DIGIT_BIT)) + 1))
-#define MP_WARRAY (MP_DEPRECATED_PRAGMA("MP_WARRAY is an internal macro") PRIVATE_MP_WARRAY)
-
 #if defined(__GNUC__) && __GNUC__ >= 4
 #   define MP_NULL_TERMINATED __attribute__((sentinel))
 #else
diff --git a/tommath_private.h b/tommath_private.h
index 7c167a5..5ccb4e2 100644
--- a/tommath_private.h
+++ b/tommath_private.h
@@ -6,6 +6,7 @@
 
 #include "tommath.h"
 #include "tommath_class.h"
+#include <limits.h>
 
 /*
  * Private symbols
@@ -163,9 +164,7 @@ typedef private_mp_word mp_word;
 #define MP_SIZEOF_BITS(type)    ((size_t)CHAR_BIT * sizeof(type))
 #define MP_MAXFAST              (int)(1uL << (MP_SIZEOF_BITS(mp_word) - (2u * (size_t)MP_DIGIT_BIT)))
 
-/* TODO: Remove PRIVATE_MP_WARRAY as soon as deprecated MP_WARRAY is removed from tommath.h */
-#undef MP_WARRAY
-#define MP_WARRAY PRIVATE_MP_WARRAY
+#define MP_WARRAY (1 << ((MP_SIZEOF_BITS(mp_word) - (2 * MP_DIGIT_BIT)) + 1))
 
 /* TODO: Remove PRIVATE_MP_PREC as soon as deprecated MP_PREC is removed from tommath.h */
 #ifdef PRIVATE_MP_PREC