initial import
[ICEs.git] / 152043 / fp_mul_comba.c.1
CommitLineData
45516216 1#define FP_SIZE \
2((4096+(4*(int)((8) * sizeof(fp_digit))))/(int)((8) * sizeof(fp_digit)))
3
4typedef unsigned long fp_digit;
5typedef struct {
6 fp_digit dp[FP_SIZE];
7 int used,
8 sign;
9} fp_int;
10
11#define MULADD(i, j) \
12asm( \
13 "movl %6,%%eax \n\t" \
14 "mull %7 \n\t" \
15 "addl %%eax,%0 \n\t" \
16 "adcl %%edx,%1 \n\t" \
17 "adcl $0,%2 \n\t" \
18 :"=r"(c0), "=r"(c1), "=r"(c2): "0"(c0), "1"(c1), "2"(c2), "m"(i), "m"(j) :"%eax","%edx","%cc");
19
20void fp_mul_comba(fp_int *A, fp_int *B, fp_int *C)
21{
22 int ix, iy, iz, tx, ty, pa;
23 fp_digit c0, c1, c2, *tmpx, *tmpy;
24 fp_int tmp, *dst;
25 for (ix = 0; ix < pa; ix++)
26 for (iz = 0; iz < iy; ++iz)
27 MULADD(*tmpx++, *tmpy--);
28}