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
		
			
				
	
	
		
			58 lines
		
	
	
		
			933 B
		
	
	
	
		
			C
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			58 lines
		
	
	
		
			933 B
		
	
	
	
		
			C
		
	
	
		
			Executable File
		
	
	
	
	
| /* int _DoubleUnsArr(a,n)
 | |
|  *
 | |
|  * ARGUMENT
 | |
|  *      unsigned        *a;
 | |
|  *      int              n;
 | |
|  *
 | |
|  * DESCRIPTION
 | |
|  *      Multiplies a by 2 and stores the result in a.
 | |
|  *
 | |
|  *
 | |
|  * SIDE EFFECTS
 | |
|  *
 | |
|  *
 | |
|  * RETURNS
 | |
|  *      SUCCESS if no overflow, otherwise FAILURE.
 | |
|  *
 | |
|  * AUTHOR
 | |
|  *      Brugnoli Giugno 1992
 | |
|  *
 | |
|  * MODIFICATIONS
 | |
|  *
 | |
|  */
 | |
| 
 | |
| #include <stdio.h>
 | |
| #include <math.h>
 | |
| #include "gm.h"
 | |
| #include "gmsystem.h"
 | |
| 
 | |
| unsigned _DoubleUnsArr(a,n)
 | |
| unsigned SHORT 				a[];
 | |
| int             n;
 | |
| {
 | |
|   int i;
 | |
|   unsigned long pdst;
 | |
|   unsigned SHORT carry = 0;
 | |
| 
 | |
|   if (n>0)
 | |
|   {
 | |
|     for (i=0;i<n;i++)
 | |
|     {
 | |
|       pdst=carry+(unsigned long)a[i]*2;
 | |
|       if (pdst>MAXUNSINT)
 | |
|       {
 | |
|         carry=(unsigned SHORT)(pdst>> BITSPERUI );
 | |
|         a[i]=(unsigned SHORT)(pdst & MAXUNSINT );
 | |
|       }
 | |
|       else
 | |
|       {
 | |
|         a[i]=(unsigned SHORT)pdst;
 | |
|         carry=0; 
 | |
| 			}
 | |
|     }
 | |
|     if ((a[n-1]) >> (BITSPERUI-1))
 | |
|       return(FAILURE);
 | |
|   }
 | |
|   return(GM_SUCCESS);
 | |
| }
 |