Skip to content

Commit

Permalink
MP_MIN_PREC>=3 is needed for s_mp_div_school
Browse files Browse the repository at this point in the history
test with valgrind and MP_PREC=MP_MIN_PREC
  • Loading branch information
minad committed Nov 3, 2019
1 parent 820f4bb commit e67fa28
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ matrix:
- env: SANITIZER=1 CONV_WARNINGS=relaxed BUILDOPTIONS='--with-cc=clang-7 --with-m64 --with-travis-valgrind'
- env: SANITIZER=1 CONV_WARNINGS=strict BUILDOPTIONS='--with-cc=clang-7 --with-m64 --with-travis-valgrind'
- env: SANITIZER=1 CONV_WARNINGS=strict BUILDOPTIONS='--with-cc=clang-7 --c89 --with-m64 --with-travis-valgrind'
- env: SANITIZER=1 BUILDOPTIONS='--with-cc=clang-7 --with-m64 --with-travis-valgrind --cflags=-DMP_PREC=MP_MIN_PREC'
- env: SANITIZER=1 BUILDOPTIONS='--with-cc=clang-6.0 --with-m64 --with-travis-valgrind'
addons:
apt:
Expand Down
8 changes: 5 additions & 3 deletions tommath_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,11 @@ MP_STATIC_ASSERT(correct_word_size, sizeof(mp_word) == (2u * sizeof(mp_digit)))
# endif
#endif

/* Minimum number of available digits in mp_int, MP_PREC >= MP_MIN_PREC */
#define MP_MIN_PREC ((((int)MP_SIZEOF_BITS(long long) + MP_DIGIT_BIT) - 1) / MP_DIGIT_BIT)

/* 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
*/
#define MP_MIN_PREC MP_MAX(3, (((int)MP_SIZEOF_BITS(long long) + MP_DIGIT_BIT) - 1) / MP_DIGIT_BIT)
MP_STATIC_ASSERT(prec_geq_min_prec, MP_PREC >= MP_MIN_PREC)

/* random number source */
Expand Down

0 comments on commit e67fa28

Please sign in to comment.