2008-07-01 Jerry DeLisle <jvdelisle@gcc.gnu.org>
[official-gcc.git] / gcc / config / divmod.c
blob6faa09102b57623dc78c07a1f39d2be8125fa826
1 long udivmodsi4 ();
3 long
4 __divsi3 (long a, long b)
6 int neg = 0;
7 long res;
9 if (a < 0)
11 a = -a;
12 neg = !neg;
15 if (b < 0)
17 b = -b;
18 neg = !neg;
21 res = udivmodsi4 (a, b, 0);
23 if (neg)
24 res = -res;
26 return res;
29 long
30 __modsi3 (long a, long b)
32 int neg = 0;
33 long res;
35 if (a < 0)
37 a = -a;
38 neg = 1;
41 if (b < 0)
42 b = -b;
44 res = udivmodsi4 (a, b, 1);
46 if (neg)
47 res = -res;
49 return res;