Mercurial > dropbear
annotate 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 |
rev | line source |
---|---|
643
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
1 #define TFM_DEFINES |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
2 #include "fp_sqr_comba.c" |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
3 |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
4 #ifdef TFM_SQR3 |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
5 void fp_sqr_comba3(fp_int *A, fp_int *B) |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
6 { |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
7 fp_digit *a, b[6], c0, c1, c2, sc0, sc1, sc2; |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
8 #ifdef TFM_ISO |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
9 fp_word tt; |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
10 #endif |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
11 |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
12 a = A->dp; |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
13 COMBA_START; |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
14 |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
15 /* clear carries */ |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
16 CLEAR_CARRY; |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
17 |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
18 /* output 0 */ |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
19 SQRADD(a[0],a[0]); |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
20 COMBA_STORE(b[0]); |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
21 |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
22 /* output 1 */ |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
23 CARRY_FORWARD; |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
24 SQRADD2(a[0], a[1]); |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
25 COMBA_STORE(b[1]); |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
26 |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
27 /* output 2 */ |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
28 CARRY_FORWARD; |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
29 SQRADD2(a[0], a[2]); SQRADD(a[1], a[1]); |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
30 COMBA_STORE(b[2]); |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
31 |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
32 /* output 3 */ |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
33 CARRY_FORWARD; |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
34 SQRADD2(a[1], a[2]); |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
35 COMBA_STORE(b[3]); |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
36 |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
37 /* output 4 */ |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
38 CARRY_FORWARD; |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
39 SQRADD(a[2], a[2]); |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
40 COMBA_STORE(b[4]); |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
41 COMBA_STORE2(b[5]); |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
42 COMBA_FINI; |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
43 |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
44 B->used = 6; |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
45 B->sign = FP_ZPOS; |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
46 memcpy(B->dp, b, 6 * sizeof(fp_digit)); |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
47 memset(B->dp + 6, 0, (FP_SIZE - 6) * sizeof(fp_digit)); |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
48 fp_clamp(B); |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
49 } |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
50 #endif |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
51 |
a362b62d38b2
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
52 |