Commit f0ab662ffcb7a08e7e6a14678dff1676c6322098

Daniel Mendler 2019-11-22T16:01:42

do not use long long for minimum prec calculation, improve comment

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
diff --git a/tommath_private.h b/tommath_private.h
index 60b3336..eb566dd 100644
--- a/tommath_private.h
+++ b/tommath_private.h
@@ -151,9 +151,10 @@ MP_STATIC_ASSERT(correct_word_size, sizeof(mp_word) == (2u * sizeof(mp_digit)))
 
 /* Minimum number of available digits in mp_int, MP_PREC >= MP_MIN_PREC
  * - Must be at least 3 for s_mp_div_school.
- * - Must be large enough such that uint64_t can be stored in mp_int without growing
+ * - Must be large enough such that the mp_set_u64 setter can
+ *   store uint64_t in the mp_int without growing
  */
-#define MP_MIN_PREC MP_MAX(3, (((int)MP_SIZEOF_BITS(long long) + MP_DIGIT_BIT) - 1) / MP_DIGIT_BIT)
+#define MP_MIN_PREC MP_MAX(3, (((int)MP_SIZEOF_BITS(uint64_t) + MP_DIGIT_BIT) - 1) / MP_DIGIT_BIT)
 MP_STATIC_ASSERT(prec_geq_min_prec, MP_PREC >= MP_MIN_PREC)
 
 /* random number source */