3d88151f4d
Files correlati :gfm.dll Ricompilazione Demo : [ ] Commento :riportate sulla 2.1 le correzioni sulla gfm.dll della 2.0 git-svn-id: svn://10.65.10.50/trunk@11815 c028cbd2-c16b-5b4b-a496-9718f37d4682
73 lines
1.6 KiB
C
Executable File
73 lines
1.6 KiB
C
Executable File
/* 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 <stdio.h>
|
|
#include <math.h>
|
|
#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;i<n;i++)
|
|
{
|
|
for(j=0;j<m;j++)
|
|
{
|
|
pdst=(unsigned long)src1[j]*(unsigned long)src2[i];
|
|
if (pdst>MAXUNSINT)
|
|
{
|
|
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];
|
|
}
|
|
|