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
51 lines
958 B
C
Executable File
51 lines
958 B
C
Executable File
/* unsigned _DivUnsArrByUns(a,c,n)
|
|
*
|
|
* ARGUMENT
|
|
* unsigned a[];
|
|
* unsigned c; number of divide by
|
|
* int n; number of digits
|
|
*
|
|
* DESCRIPTION
|
|
* Divides a number of n digits (a) by c and stores the result in a.
|
|
* The remainder is calculated and returnes.
|
|
*
|
|
* SIDE EFFECTS
|
|
* None.
|
|
*
|
|
* RETURNS
|
|
* Remainder.
|
|
*
|
|
* AUTHOR
|
|
* Brugnoli Giugno 1992
|
|
* Bonazzi Febbraio 2002
|
|
*
|
|
* MODIFICATIONS
|
|
*
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
#include "gm.h"
|
|
#include "gmsystem.h"
|
|
|
|
unsigned _DivUnsArrByUns(a,c,n)
|
|
unsigned SHORT a[],c;
|
|
int n;
|
|
{
|
|
int i;
|
|
unsigned SHORT rem = 0,qt;
|
|
unsigned long remup,ntbd;
|
|
|
|
if ((c) && (n))
|
|
{
|
|
for (i = n-1; i >= 0;i--)
|
|
{
|
|
remup = (long)rem << BITSPERUI;
|
|
ntbd = (long)a[i] + remup;
|
|
qt = (unsigned SHORT)(ntbd / c);
|
|
rem = (unsigned SHORT)(ntbd % c);
|
|
a[i] = qt;
|
|
}
|
|
}
|
|
return(rem);
|
|
}
|