* this is the final commit of a series of simplifications,
containing only the regenerated files and the explanation in the
commit message
* This is in preparation of the size_t change/a potential representation change to use
full width as in tfm, if a (partial?) merge with tfm is desired.
These changes have their own merits however.
* Remove obfuscating tmpx digit pointers (fewer variables, it is more obvious what is
being manipulated)
* Reduce scope of variables where possible
* Stricter error handling/checking (for example handling in karatsuba
was broken)
* In some cases the result was written even in the case of an error
(e.g. s_mp_is_divisible). This will hide bugs, since the user should
check the return value (enforced by MP_WUR). Furthermore if the user
accesses the non-initialized result, valgrind will complain for
example. Global static analysis like coverity will also detect the issue.
Therefore this improves the status quo.
* Introduce generic, private MP_EXCH macro which can be used to swap values.
* Introduce s_mp_copy_digs/s_mp_zero_digs/s_mp_zero_buf
* Some control flow simplifications, e.g, loops instead of goto
* Renamings of variables/labels for consistency
* Renamings of mul/sqr functions for more consistency, e.g., comba
instead of fast suffix
* I didn't read through some very complex functions.
They are so complex, I am too afraid and lazy to touch them.
Maybe someone resposible wants to simplify them if possible. Hint... Hint...
- mp_prime_strong_lucas_selfridge.c
- s_mp_exptmod.c
- s_mp_exptmod_fast.c
These functions were introduced to give some timing guarantees.
However the guarantees are too weak to be useful.
The functions seem to be unused essentially by downstream users.
* it is an implementation detail used for prime testing
* there is upcoming work by @czurnieden regarding a generalised prime sieve
* furthermore remove jacobi test (replaced by kronecker)
* same behavior for positive numbers
* generalisation for negative numbers, treating them as two complement
* improve algorithm, iterate once over the digits, manually perform two complement
* simplify mp_add_d, mp_sub_d
* functions are safe in case of a==c or b==c
* renamed mp_tc_div_2d to mp_signed_rsh (signed right shift)
The return type of mp_get_bit was imprecise (either mp_err or mp_bool),
therefore this function is deprecated in favor of s_mp_get_bit for now.
If we need s_mp_get_bit to be public, we should add it under a different
name. However since mp_set_bit is not available, I don't think there any
downstream users (ab)using mp_int as bitsets.