remove private_mp_word
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
diff --git a/etc/pprime.c b/etc/pprime.c
index 50be809..411e446 100644
--- a/etc/pprime.c
+++ b/etc/pprime.c
@@ -8,9 +8,6 @@
#include <time.h>
#include "tommath.h"
-/* TODO: Remove private_mp_word as soon as deprecated mp_word is removed from tommath. */
-typedef private_mp_word mp_word;
-
static int n_prime;
static FILE *primes;
diff --git a/tommath.h b/tommath.h
index 9421c6d..f415a7f 100644
--- a/tommath.h
+++ b/tommath.h
@@ -51,21 +51,14 @@ extern "C" {
* [any size beyond that is ok provided it doesn't overflow the data type]
*/
-
#if defined(MP_16BIT)
typedef uint16_t mp_digit;
-typedef uint32_t private_mp_word;
# define MP_DIGIT_BIT 15
#elif defined(MP_64BIT)
-/* for GCC only on supported platforms */
typedef uint64_t mp_digit;
-#if defined(__GNUC__)
-typedef unsigned long private_mp_word __attribute__((mode(TI)));
-#endif
# define MP_DIGIT_BIT 60
#else
typedef uint32_t mp_digit;
-typedef uint64_t private_mp_word;
# ifdef MP_31BIT
/*
* This is an extension that uses 31-bit digits.
diff --git a/tommath_private.h b/tommath_private.h
index e37def4..b18663b 100644
--- a/tommath_private.h
+++ b/tommath_private.h
@@ -148,9 +148,6 @@ extern void MP_FREE(void *mem, size_t size);
#define MP__STRINGIZE(x) ""#x""
#define MP_HAS(x) (sizeof(MP_STRINGIZE(x##_C)) == 1u)
-/* TODO: Remove private_mp_word as soon as deprecated mp_word is removed from tommath. */
-typedef private_mp_word mp_word;
-
#define MP_MIN(x, y) (((x) < (y)) ? (x) : (y))
#define MP_MAX(x, y) (((x) > (y)) ? (x) : (y))
@@ -167,6 +164,15 @@ typedef private_mp_word mp_word;
#define MP_WARRAY (1 << ((MP_SIZEOF_BITS(mp_word) - (2 * MP_DIGIT_BIT)) + 1))
+#if defined(MP_16BIT)
+typedef uint32_t mp_word;
+#elif defined(MP_64BIT)
+typedef unsigned long mp_word __attribute__((mode(TI)));
+#else
+typedef uint64_t mp_word;
+#endif
+
+MP_STATIC_ASSERT(correct_word_size, sizeof(mp_word) == 2 * sizeof(mp_digit))
/* default precision */
#ifndef MP_PREC