13
15
* Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
22
19
* shifts with subtractions when the result is greater than b.
24
21
* The method is slightly modified to shift B unconditionally upto just under
25
22
* the leading bit of b. This saves alot of multiple precision shifting.
32
28
/* how many bits of last digit does b use */
33
29
bits = mp_count_bits (b) % DIGIT_BIT;
40
42
/* now compute C = A * B mod b */
41
43
for (x = bits - 1; x < (int)DIGIT_BIT; x++) {
42
44
if ((res = mp_mul_2 (a, a)) != MP_OKAY) {