Commit Graph

208 Commits

Author SHA1 Message Date
czurnieden
fb305e093d Additional input checks and a test for b \cong 0 (mod a) in test_mp_sqrtmod_prime
to go along with it.
2020-09-15 23:49:09 +02:00
Daniel Green
ea65456607 Give correct values for invmod with modulus of 1 2020-03-05 15:52:28 -05:00
Steffen Jaeckel
c1cf807382 introduce MP_HAS_SET_DOUBLE 2020-03-05 14:11:13 +01:00
Steffen Jaeckel
c5cb0c6f62 fix compile error on MSVC 2020-03-05 14:08:38 +01:00
Daniel Green
4e90f3185a
Build+test bn_mp_set_double.c on more platforms
Not all platforms/environments/architectures that support enough of
IEEE 754 for the purposes of mp_set_double() actually support enough
to legitimately define __STDC_IEC_559__, so only relying on that is
too strict. Fixes https://github.com/libtom/libtommath/issues/159
2020-02-18 00:00:22 +01:00
Daniel Mendler
40177e18e5
test: print __func__ 2019-12-05 13:50:14 +01:00
Daniel Mendler
c375b03819
test cleanup; add randomized radix_size test 2019-12-05 13:50:11 +01:00
Daniel Mendler
08d281c462
introduce MP_MAX_DIGIT_COUNT to prevent overflow 2019-12-05 10:52:41 +01:00
Daniel Mendler
9d0bdc7efb
run the test always 2019-12-04 22:23:24 +01:00
czurnieden
1e65c0bfe4
Introduction of a fast but slightly over-estimating radix_size 2019-12-04 21:39:02 +01:00
czurnieden
5f3063fb2a correction of typo in test.c 2019-11-22 03:14:59 +01:00
czurnieden
642032ddc7 wrong sign in mp_div_recursive 2019-11-22 02:56:48 +01:00
Jan Nijtmans
bb1e56e775
Fix compilation of demo/test.c using C++ 2019-11-14 14:18:45 +01:00
Jan Nijtmans
9f2cd04301
more unnecessary type-casts, correct type-case for malloc 2019-11-14 14:18:45 +01:00
Jan Nijtmans
e9d54e9867
remove unnecessary type-casts 2019-11-14 14:18:45 +01:00
Jan Nijtmans
a91eb5a0d9
fix build (hopefully) 2019-11-14 14:18:45 +01:00
Jan Nijtmans
9cfb6c3298
use type-cast in stead of UINT64_C 2019-11-14 14:18:45 +01:00
Jan Nijtmans
02aa95c2b5
Fix wrong use of uLL suffix 2019-11-14 14:18:45 +01:00
Daniel Mendler
f6a7bedb95 suffix _u32 -> _n of mp_(expt|log|root) functions, use int for now 2019-11-14 09:16:00 +01:00
Daniel Mendler
4f00e75b8f
make mp_div_3 private 2019-11-09 06:43:58 +01:00
Daniel Mendler
e8e65119d1
add COMPILE_LTO to test link time optimization
the library performs best with lto since many small functions
can be inlined across objects.
2019-11-05 20:28:59 +01:00
nijtmans
bbb178089d
mp_radix off-by-one error and other related code-cleanup 2019-11-05 20:15:24 +01:00
Francois Perrad
40342807dc explicit operator precedence 2019-11-05 18:45:48 +01:00
Francois Perrad
146becbd9a literal suffix 2019-11-05 18:43:37 +01:00
Daniel Mendler
5c335f8407
rename mul/sqr functions for consistency, comba instead of fast suffix 2019-11-04 15:41:33 +01:00
Daniel Mendler
b9977adfb8
use uint8_t instead of unsigned char 2019-10-29 17:40:59 +01:00
Steffen Jaeckel
af376edcde no more MP_WUR in timing.c 2019-10-29 16:37:56 +01:00
Steffen Jaeckel
4500d066c1 also no MP_WUR in mtest_opponent() 2019-10-29 14:41:33 +01:00
Steffen Jaeckel
b250ec44e0 clean-up test.c
* no more `MP_WUR` in test.c
* clean-up console output
2019-10-29 13:24:34 +01:00
Steffen Jaeckel
04ee1e75d7 improve demo/timing a bit
* less verbose output on console
* allow changing name for logs
* pre-heat caches before starting the timing
2019-10-28 15:31:36 +01:00
Daniel Mendler
bf9507a9d4
replace mp_bool by stdbool
* This gives the advantage that static analysis **understands** bool,
  but complains about using an enum type instead of bool.

* If stdbool.h is not desired, true/false/bool can be replaced using sed
  as in the no-stdint-h branch.

* We already include stdint.h and stdbool.h is not more harmful than
  this header
2019-10-27 18:36:56 +01:00
Daniel Mendler
27e142bc43
remove unnecessary == MP_YES/MP_NO comparisons 2019-10-27 18:36:55 +01:00
Daniel Mendler
14642642f9
add prefix to cutoff variables 2019-10-23 18:21:57 +02:00
Steffen Jaeckel
3180c66ca6 also use MP_YES/NO in tests 2019-10-23 18:17:20 +02:00
czurnieden
9edd185f66 Addition of fast division (recursive divrem only) 2019-10-22 21:02:18 +02:00
Daniel Mendler
a29aa59baa
use size_t for mp_radix_size 2019-10-22 14:25:58 +02:00
Francois Perrad
485be9de79 explicit condition 2019-10-20 17:31:04 +02:00
Francois Perrad
3995ece51b const parameter 2019-10-20 17:30:55 +02:00
Francois Perrad
315975db7a remove useless initialization 2019-10-20 17:30:50 +02:00
Francois Perrad
7f05df0a80 const parameter 2019-10-20 17:30:47 +02:00
Steffen Jaeckel
7a68f12873 Execute move.sh - Rename files from bn_* to match the function names.
* git blame <renamed-file> is not affected
* git log --follow <renamed-file> can be used to show log across renames
2019-10-19 16:24:39 +02:00
czurnieden
36fca2f9a0
remove support for 8-bit (MP_8BIT) 2019-10-19 16:03:26 +02:00
czurnieden
d4f6b43fa8
use of mp_ilogb in mp_radix_size 2019-10-19 15:35:04 +02:00
Daniel Mendler
45a3bf7694
remove deprecated functions 2019-10-17 16:56:27 +02:00
Daniel Mendler
cb1b2dc879
mp_log_u32: return uint32_t 2019-10-15 14:47:43 +02:00
Steffen Jaeckel
c9d41fba73
rename mp_ilogb() to mp_log_u32() 2019-10-15 14:47:43 +02:00
Steffen Jaeckel
1cc02f2d88
fix build of timing.c 2019-10-15 14:47:43 +02:00
Daniel Mendler
b4f7d8d4c8
test: use malloc/free
tests are library consumers, MP_MALLOC is an internal macro
2019-10-09 20:46:44 +02:00
Daniel Mendler
6e3dae5625
add MP_BUF error 2019-10-08 22:30:29 +02:00
czurnieden
b6813a4122
replace mp_export/import by mp_pack/unpack 2019-10-08 22:30:25 +02:00