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 "bignum_fast.h"
13
void fp_mul(fp_int *A, fp_int *B, fp_int *C)
17
/* call generic if we're out of range */
18
if (A->used + B->used > FP_SIZE) {
19
fp_mul_comba(A, B, C);
23
y = MAX(A->used, B->used);
24
yy = MIN(A->used, B->used);
25
/* pick a comba (unrolled 4/8/16/32 x or rolled) based on the size
26
of the largest input. We also want to avoid doing excess mults if the
27
inputs are not close to the next power of two. That is, for example,
28
if say y=17 then we would do (32-17)^2 = 225 unneeded multiplications
69
fp_mul_comba12(A,B,C);
75
fp_mul_comba17(A,B,C);
82
fp_mul_comba_small(A,B,C);
86
#if defined(TFM_MUL20)
88
fp_mul_comba20(A,B,C);
92
#if defined(TFM_MUL24)
93
if (yy >= 16 && y <= 24) {
94
fp_mul_comba24(A,B,C);
98
#if defined(TFM_MUL28)
99
if (yy >= 20 && y <= 28) {
100
fp_mul_comba28(A,B,C);
104
#if defined(TFM_MUL32)
105
if (yy >= 24 && y <= 32) {
106
fp_mul_comba32(A,B,C);
110
#if defined(TFM_MUL48)
111
if (yy >= 40 && y <= 48) {
112
fp_mul_comba48(A,B,C);
116
#if defined(TFM_MUL64)
117
if (yy >= 56 && y <= 64) {
118
fp_mul_comba64(A,B,C);
126
/* $Source: /cvs/libtom/tomsfastmath/src/mul/fp_mul.c,v $ */
127
/* $Revision: 1.1 $ */
128
/* $Date: 2006/12/31 21:25:53 $ */