comparison tomsfastmath/src/mul/fp_mul_comba_3.c @ 643:a362b62d38b2 dropbear-tfm

Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a with Makefile.in renamed
author Matt Johnston <matt@ucc.asn.au>
date Wed, 23 Nov 2011 18:10:20 +0700
parents
children
comparison
equal deleted inserted replaced
642:33fd2f3499d2 643:a362b62d38b2
1 #define TFM_DEFINES
2 #include "fp_mul_comba.c"
3
4 #ifdef TFM_MUL3
5 void fp_mul_comba3(fp_int *A, fp_int *B, fp_int *C)
6 {
7 fp_digit c0, c1, c2, at[6];
8
9 memcpy(at, A->dp, 3 * sizeof(fp_digit));
10 memcpy(at+3, B->dp, 3 * sizeof(fp_digit));
11 COMBA_START;
12
13 COMBA_CLEAR;
14 /* 0 */
15 MULADD(at[0], at[3]);
16 COMBA_STORE(C->dp[0]);
17 /* 1 */
18 COMBA_FORWARD;
19 MULADD(at[0], at[4]); MULADD(at[1], at[3]);
20 COMBA_STORE(C->dp[1]);
21 /* 2 */
22 COMBA_FORWARD;
23 MULADD(at[0], at[5]); MULADD(at[1], at[4]); MULADD(at[2], at[3]);
24 COMBA_STORE(C->dp[2]);
25 /* 3 */
26 COMBA_FORWARD;
27 MULADD(at[1], at[5]); MULADD(at[2], at[4]);
28 COMBA_STORE(C->dp[3]);
29 /* 4 */
30 COMBA_FORWARD;
31 MULADD(at[2], at[5]);
32 COMBA_STORE(C->dp[4]);
33 COMBA_STORE2(C->dp[5]);
34 C->used = 6;
35 C->sign = A->sign ^ B->sign;
36 fp_clamp(C);
37 COMBA_FINI;
38 }
39 #endif