comparison tomsfastmath/src/sqr/fp_sqr_comba_4.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_SQR4
5 void fp_sqr_comba4(fp_int *A, fp_int *B)
6 {
7 fp_digit *a, b[8], 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[1], a[3]); SQRADD(a[2], a[2]);
40 COMBA_STORE(b[4]);
41
42 /* output 5 */
43 CARRY_FORWARD;
44 SQRADD2(a[2], a[3]);
45 COMBA_STORE(b[5]);
46
47 /* output 6 */
48 CARRY_FORWARD;
49 SQRADD(a[3], a[3]);
50 COMBA_STORE(b[6]);
51 COMBA_STORE2(b[7]);
52 COMBA_FINI;
53
54 B->used = 8;
55 B->sign = FP_ZPOS;
56 memcpy(B->dp, b, 8 * sizeof(fp_digit));
57 memset(B->dp + 8, 0, (FP_SIZE - 8) * sizeof(fp_digit));
58 fp_clamp(B);
59 }
60 #endif
61
62