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
		
			
				
	
	
		
			56 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			C
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			56 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			C
		
	
	
		
			Executable File
		
	
	
	
	
/* void _MulUnsArr(src1,dst,num,n)
 | 
						|
 *
 | 
						|
 * ARGUMENT
 | 
						|
 *      unsigned        *src1, *dst, num;
 | 
						|
 *      unsigned        n;
 | 
						|
 *
 | 
						|
 * DESCRIPTION
 | 
						|
 *      Multiplies the number 'a' (of 'n' 16-bits ints) by num and places
 | 
						|
 *  the result in dst. We assume that the caller has made sure there are
 | 
						|
 *  enough ints to hold the result. We don't check for overflow!!!.
 | 
						|
 *
 | 
						|
 * SIDE EFFECTS
 | 
						|
 *      Can't have more than 10 ints to multiply.
 | 
						|
 *
 | 
						|
 * RETURNS
 | 
						|
 *      None.
 | 
						|
 *
 | 
						|
 * AUTHOR
 | 
						|
 *      Brugnoli Giugno 1992
 | 
						|
 *
 | 
						|
 * MODIFICATIONS
 | 
						|
 *
 | 
						|
 */
 | 
						|
 | 
						|
#include <stdio.h>
 | 
						|
#include <math.h>
 | 
						|
#include "gm.h"
 | 
						|
#include "gmsystem.h"
 | 
						|
 | 
						|
void _MulUnsArr(src1, dst, num, n)
 | 
						|
unsigned SHORT        src1[], dst[], num;
 | 
						|
int             n;
 | 
						|
{
 | 
						|
  int i;
 | 
						|
  unsigned long pdst[10];
 | 
						|
  unsigned SHORT carry = 0;
 | 
						|
 | 
						|
  for (i=0;i<n;i++)
 | 
						|
    pdst[i]=(unsigned long)src1[i]*num;
 | 
						|
 | 
						|
  for (i=0;i<n;i++)
 | 
						|
  {
 | 
						|
    pdst[i]+=carry;
 | 
						|
    if (pdst[i]>MAXUNSINT)
 | 
						|
    {
 | 
						|
      carry=(unsigned SHORT)(pdst[i]>>BITSPERUI);
 | 
						|
      dst[i]=(unsigned SHORT)(pdst[i]&MAXUNSINT);
 | 
						|
    }
 | 
						|
    else
 | 
						|
    {
 | 
						|
      carry=0;
 | 
						|
      dst[i]=(unsigned SHORT)pdst[i];
 | 
						|
    }
 | 
						|
  }
 | 
						|
}
 |