/* void _MulUnsArrByUnsArr(src1,src2,dst,m,n,tmp1) * * ARGUMENT * unsigned src1[m], src2[n], dst[10]; * unsigned n,m; m<=5 n<=5 * int tmp1 where tmp1 is used as a temp multiplier for each loop * * DESCRIPTION * Multiplies multiplier by multiplicand giving dst. Src1 and Src2 * are 80bit x 80bit is computed to 160bit. As each int is multiplied * to obtain the partial product, it is added to the dst and any * carries are added to succeeding coloumn location in the dst array. * * SIDE EFFECTS * Neither src1 and src2 can have the MSB of the high-order int set * * RETURNS * None. * * AUTHOR * Brugnoli Giugno 1992 * * MODIFICATIONS * */ #include #include #include "gm.h" #include "gmsystem.h" extern double pow(double, double); void _MulUnsArrByUnsArr(src1, src2, dst, m, n, tmp1) unsigned SHORT src1[], src2[], dst[]; int n,m,tmp1; { int i,j; unsigned long apdst[10]; unsigned long pdst; tmp1=0; for(i=0;i<10;i++) apdst[i]=0; for(i=0;iMAXUNSINT) { apdst[i+j+1]+=(unsigned long)(pdst>>BITSPERUI); apdst[i+j]+=(unsigned long)(pdst&MAXUNSINT); } else apdst[i+j]+=(unsigned long)pdst; } } for(i=0;i<10;i++) { if (apdst[i]>MAXUNSINT) { apdst[i+1]+=(unsigned long)(apdst[i]>>BITSPERUI); apdst[i]=(unsigned long)(apdst[i]&MAXUNSINT); } } for(i=0;i<10;i++) dst[i]=(unsigned SHORT)apdst[i]; }