1 /* LibTomMath, multiple-precision integer library -- Tom St Denis
\r
3 * LibTomMath is library that provides for multiple-precision
\r
4 * integer arithmetic as well as number theoretic functionality.
\r
6 * The library is designed directly after the MPI library by
\r
7 * Michael Fromberger but has been written from scratch with
\r
8 * additional optimizations in place.
\r
10 * The library is free for all purposes without any express
\r
11 * guarantee it works.
\r
13 * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
\r
15 #include <tommath.h>
\r
17 /* determines if mp_reduce_2k can be used */
\r
19 mp_reduce_is_2k(mp_int *a)
\r
25 } else if (a->used == 1) {
\r
27 } else if (a->used > 1) {
\r
28 iy = mp_count_bits(a);
\r
29 for (ix = DIGIT_BIT; ix < iy; ix++) {
\r
30 if ((a->dp[ix/DIGIT_BIT] &
\r
31 ((mp_digit)1 << (mp_digit)(ix % DIGIT_BIT))) == 0) {
\r