2 (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
3 See the copyright notice in the ACK home directory, in the file "Copyright".
6 /* $Id: flt_mul.c,v 1.7 1994/06/24 11:16:01 ceriel Exp $ */
12 register flt_arith *e1,*e2,*e3;
14 /* Multiply the extended numbers e1 and e2, and put the
17 register int i,j; /* loop control */
20 unsigned short result[8]; /* result */
22 register unsigned short *pres;
26 /* first save the sign (XOR) */
27 e3->flt_sign = e1->flt_sign ^ e2->flt_sign;
29 /* compute new exponent */
30 e3->flt_exp = e1->flt_exp + e2->flt_exp + 1;
32 /* 128 bit multiply of mantissas */
34 /* assign unknown long formats */
35 /* to known unsigned word formats */
42 * fill registers with their components
44 for(i=4, pres = &result[4];i--;pres--) if (mp[i]) {
48 long tmp = (long)pres[j] + k;
49 if (mc[j]) tmp += mpi * mc[j];
50 pres[j] = tmp & 0xFFFF;
51 k = (tmp >> 16) & 0xFFFF;
56 if (! (result[0] & 0x8000)) {
58 for (i = 0; i <= 3; i++) {
60 if (result[i+1]&0x8000) result[i] |= 1;
65 * combine the registers to a total
67 e3->m1 = ((long)result[0] << 16) + result[1];
68 e3->m2 = ((long)result[2] << 16) + result[3];
69 if (result[4] & 0x8000) {
70 if (++e3->m2 == 0 || (e3->m2 & ~ 0xFFFFFFFF)) {
72 if (++e3->m1 == 0 || (e3->m1 & ~ 0xFFFFFFFF)) {