comparison tomsfastmath/src/sqr/fp_sqr_comba_6.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_sqr_comba.c"
3
4 #ifdef TFM_SQR6
5 void fp_sqr_comba6(fp_int *A, fp_int *B)
6 {
7 fp_digit *a, b[12], c0, c1, c2, sc0, sc1, sc2;
8 #ifdef TFM_ISO
9 fp_word tt;
10 #endif
11
12 a = A->dp;
13 COMBA_START;
14
15 /* clear carries */
16 CLEAR_CARRY;
17
18 /* output 0 */
19 SQRADD(a[0],a[0]);
20 COMBA_STORE(b[0]);
21
22 /* output 1 */
23 CARRY_FORWARD;
24 SQRADD2(a[0], a[1]);
25 COMBA_STORE(b[1]);
26
27 /* output 2 */
28 CARRY_FORWARD;
29 SQRADD2(a[0], a[2]); SQRADD(a[1], a[1]);
30 COMBA_STORE(b[2]);
31
32 /* output 3 */
33 CARRY_FORWARD;
34 SQRADD2(a[0], a[3]); SQRADD2(a[1], a[2]);
35 COMBA_STORE(b[3]);
36
37 /* output 4 */
38 CARRY_FORWARD;
39 SQRADD2(a[0], a[4]); SQRADD2(a[1], a[3]); SQRADD(a[2], a[2]);
40 COMBA_STORE(b[4]);
41
42 /* output 5 */
43 CARRY_FORWARD;
44 SQRADDSC(a[0], a[5]); SQRADDAC(a[1], a[4]); SQRADDAC(a[2], a[3]); SQRADDDB;
45 COMBA_STORE(b[5]);
46
47 /* output 6 */
48 CARRY_FORWARD;
49 SQRADD2(a[1], a[5]); SQRADD2(a[2], a[4]); SQRADD(a[3], a[3]);
50 COMBA_STORE(b[6]);
51
52 /* output 7 */
53 CARRY_FORWARD;
54 SQRADD2(a[2], a[5]); SQRADD2(a[3], a[4]);
55 COMBA_STORE(b[7]);
56
57 /* output 8 */
58 CARRY_FORWARD;
59 SQRADD2(a[3], a[5]); SQRADD(a[4], a[4]);
60 COMBA_STORE(b[8]);
61
62 /* output 9 */
63 CARRY_FORWARD;
64 SQRADD2(a[4], a[5]);
65 COMBA_STORE(b[9]);
66
67 /* output 10 */
68 CARRY_FORWARD;
69 SQRADD(a[5], a[5]);
70 COMBA_STORE(b[10]);
71 COMBA_STORE2(b[11]);
72 COMBA_FINI;
73
74 B->used = 12;
75 B->sign = FP_ZPOS;
76 memcpy(B->dp, b, 12 * sizeof(fp_digit));
77 memset(B->dp + 12, 0, (FP_SIZE - 12) * sizeof(fp_digit));
78 fp_clamp(B);
79 }
80 #endif
81
82