1 /* TomsFastMath, a fast ISO C bignum library.
3 * This project is meant to fill in where LibTomMath
4 * falls short. That is speed ;-)
6 * This project is public domain and free for all purposes.
8 * Tom St Denis, tomstdenis@gmail.com
10 #include <tfm_private.h>
13 void fp_div_2(fp_int * a, fp_int * b)
20 register fp_digit r, rr, *tmpa, *tmpb;
23 tmpa = a->dp + b->used - 1;
26 tmpb = b->dp + b->used - 1;
30 for (x = b->used - 1; x >= 0; x--) {
31 /* get the carry for the next iteration */
34 /* shift the current digit, add in carry and store */
35 *tmpb-- = (*tmpa-- >> 1) | (r << (DIGIT_BIT - 1));
37 /* forward carry to next iteration */
41 /* zero excess digits */
42 tmpb = b->dp + b->used;
43 for (x = b->used; x < oldused; x++) {