8sa1-gcc/gcc/config/divmod.c
Stephane Carrez 75273d0832 udivmod.c, [...]: Moved from here.
* config/mn10200/udivmod.c, config/mn10200/divmod.c,
	config/mn10200/udivmodsi4.c: Moved from here.
	* config/udivmod.c, config/divmod.c, config/udivmodsi4.c: To here.
	* config/mn10200/t-mn10200 (LIB2FUNCS_EXTRA): Use the generic
	C division functions.
	* config/m68hc11/t-m68hc11-gas (LIB2FUNCS_EXTRA): Likewise.

From-SVN: r37868
2000-11-30 01:25:59 -07:00

51 lines
491 B
C

long udivmodsi4 ();
long
__divsi3 (long a, long b)
{
int neg = 0;
long res;
if (a < 0)
{
a = -a;
neg = !neg;
}
if (b < 0)
{
b = -b;
neg = !neg;
}
res = udivmodsi4 (a, b, 0);
if (neg)
res = -res;
return res;
}
long
__modsi3 (long a, long b)
{
int neg = 0;
long res;
if (a < 0)
{
a = -a;
neg = 1;
}
if (b < 0)
b = -b;
res = udivmodsi4 (a, b, 1);
if (neg)
res = -res;
return res;
}