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
		
			
				
	
	
		
			53 lines
		
	
	
		
			995 B
		
	
	
	
		
			C
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			53 lines
		
	
	
		
			995 B
		
	
	
	
		
			C
		
	
	
		
			Executable File
		
	
	
	
	
| /* int _SubUnsArrFromUnsArr(src1,src2,dst,n)
 | |
|  *
 | |
|  * ARGUMENT
 | |
|  *      unsigned        *src1, *src2, *dst;
 | |
|  *      unsigned        n;
 | |
|  *
 | |
|  * DESCRIPTION
 | |
|  *      Subtracts src2 from src2 giving dst. src1 and src2 are unchanged.
 | |
|  *  src1, src2 and dst point to unsigned arrays.
 | |
|  *
 | |
|  * SIDE EFFECTS
 | |
|  *
 | |
|  *
 | |
|  * RETURNS
 | |
|  *      GM_SUCCESS if no overflow, otherwise GM_FAILURE.
 | |
|  *
 | |
|  * AUTHOR
 | |
|  *      Brugnoli Giugno 1992
 | |
|  *
 | |
|  * MODIFICATIONS
 | |
|  *
 | |
|  */
 | |
| 
 | |
| #include <stdio.h>
 | |
| #include <math.h>
 | |
| #include "gm.h"
 | |
| #include "gmsystem.h"
 | |
| 
 | |
| int _SubUnsArrFromUnsArr(src1, src2, dst, n)
 | |
| unsigned SHORT        src1[], src2[], dst[];
 | |
| int             n;
 | |
| {
 | |
|   int i;
 | |
|   unsigned long psrc;
 | |
|   unsigned SHORT carry = 0;
 | |
| 
 | |
|   if (n>0)
 | |
|   {
 | |
|     for (i=0;i<n;i++)
 | |
|     {
 | |
|       psrc= (long)src1[i] - (long)carry;
 | |
|       carry = src2[i] > src1[i] ? 1 : 0;
 | |
|       
 | |
| 			if (carry)
 | |
|         psrc += MAXUNSINT+0x1L;
 | |
|       dst[i]=(unsigned SHORT)(psrc-(unsigned long)src2[i]);
 | |
|     }
 | |
|     if (carry)
 | |
|       return(GM_FAILURE);
 | |
|   }
 | |
|   return(GM_SUCCESS);
 | |
| }
 |