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
11 /* program emits a NxN comba multiplier */
14 int main(int argc, char **argv)
19 /* print out preamble */
21 "#define TFM_DEFINES\n"
22 "#include \"fp_mul_comba.c\"\n"
24 "#if defined(TFM_MUL%d) && FP_SIZE >= %d\n"
25 "void fp_mul_comba%d(fp_int *A, fp_int *B, fp_int *C)\n"
27 " fp_digit c0, c1, c2, at[%d];\n"
29 " memcpy(at, A->dp, %d * sizeof(fp_digit));\n"
30 " memcpy(at+%d, B->dp, %d * sizeof(fp_digit));\n"
33 " COMBA_CLEAR;\n", N, N+N, N, N+N, N, N, N);
36 for (x = 0; x < (N+N-1); x++) {
43 for (y = 0; y < N; y++) {
44 for (z = 0; z < N; z++) {
46 printf(" MULADD(at[%d], at[%d]); ", y, z+N);
52 " COMBA_STORE(C->dp[%d]);\n", x);
55 " COMBA_STORE2(C->dp[%d]);\n"
57 " C->sign = A->sign ^ B->sign;\n"