comparison tomsfastmath/src/mul/fp_mul_comba_7.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_MUL7
5 void fp_mul_comba7(fp_int *A, fp_int *B, fp_int *C)
6 {
7 fp_digit c0, c1, c2, at[14];
8
9 memcpy(at, A->dp, 7 * sizeof(fp_digit));
10 memcpy(at+7, B->dp, 7 * sizeof(fp_digit));
11 COMBA_START;
12
13 COMBA_CLEAR;
14 /* 0 */
15 MULADD(at[0], at[7]);
16 COMBA_STORE(C->dp[0]);
17 /* 1 */
18 COMBA_FORWARD;
19 MULADD(at[0], at[8]); MULADD(at[1], at[7]);
20 COMBA_STORE(C->dp[1]);
21 /* 2 */
22 COMBA_FORWARD;
23 MULADD(at[0], at[9]); MULADD(at[1], at[8]); MULADD(at[2], at[7]);
24 COMBA_STORE(C->dp[2]);
25 /* 3 */
26 COMBA_FORWARD;
27 MULADD(at[0], at[10]); MULADD(at[1], at[9]); MULADD(at[2], at[8]); MULADD(at[3], at[7]);
28 COMBA_STORE(C->dp[3]);
29 /* 4 */
30 COMBA_FORWARD;
31 MULADD(at[0], at[11]); MULADD(at[1], at[10]); MULADD(at[2], at[9]); MULADD(at[3], at[8]); MULADD(at[4], at[7]);
32 COMBA_STORE(C->dp[4]);
33 /* 5 */
34 COMBA_FORWARD;
35 MULADD(at[0], at[12]); MULADD(at[1], at[11]); MULADD(at[2], at[10]); MULADD(at[3], at[9]); MULADD(at[4], at[8]); MULADD(at[5], at[7]);
36 COMBA_STORE(C->dp[5]);
37 /* 6 */
38 COMBA_FORWARD;
39 MULADD(at[0], at[13]); MULADD(at[1], at[12]); MULADD(at[2], at[11]); MULADD(at[3], at[10]); MULADD(at[4], at[9]); MULADD(at[5], at[8]); MULADD(at[6], at[7]);
40 COMBA_STORE(C->dp[6]);
41 /* 7 */
42 COMBA_FORWARD;
43 MULADD(at[1], at[13]); MULADD(at[2], at[12]); MULADD(at[3], at[11]); MULADD(at[4], at[10]); MULADD(at[5], at[9]); MULADD(at[6], at[8]);
44 COMBA_STORE(C->dp[7]);
45 /* 8 */
46 COMBA_FORWARD;
47 MULADD(at[2], at[13]); MULADD(at[3], at[12]); MULADD(at[4], at[11]); MULADD(at[5], at[10]); MULADD(at[6], at[9]);
48 COMBA_STORE(C->dp[8]);
49 /* 9 */
50 COMBA_FORWARD;
51 MULADD(at[3], at[13]); MULADD(at[4], at[12]); MULADD(at[5], at[11]); MULADD(at[6], at[10]);
52 COMBA_STORE(C->dp[9]);
53 /* 10 */
54 COMBA_FORWARD;
55 MULADD(at[4], at[13]); MULADD(at[5], at[12]); MULADD(at[6], at[11]);
56 COMBA_STORE(C->dp[10]);
57 /* 11 */
58 COMBA_FORWARD;
59 MULADD(at[5], at[13]); MULADD(at[6], at[12]);
60 COMBA_STORE(C->dp[11]);
61 /* 12 */
62 COMBA_FORWARD;
63 MULADD(at[6], at[13]);
64 COMBA_STORE(C->dp[12]);
65 COMBA_STORE2(C->dp[13]);
66 C->used = 14;
67 C->sign = A->sign ^ B->sign;
68 fp_clamp(C);
69 COMBA_FINI;
70 }
71 #endif