comparison tomsfastmath/src/sqr/fp_sqr_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_sqr_comba.c"
3
4 #ifdef TFM_SQR3
5 void fp_sqr_comba3(fp_int *A, fp_int *B)
6 {
7 fp_digit *a, b[6], 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[1], a[2]);
35 COMBA_STORE(b[3]);
36
37 /* output 4 */
38 CARRY_FORWARD;
39 SQRADD(a[2], a[2]);
40 COMBA_STORE(b[4]);
41 COMBA_STORE2(b[5]);
42 COMBA_FINI;
43
44 B->used = 6;
45 B->sign = FP_ZPOS;
46 memcpy(B->dp, b, 6 * sizeof(fp_digit));
47 memset(B->dp + 6, 0, (FP_SIZE - 6) * sizeof(fp_digit));
48 fp_clamp(B);
49 }
50 #endif
51
52