OSDN Git Service

2006-01-26 Paolo Bonzini <bonzini@gnu.org>
[pf3gnuchains/gcc-fork.git] / gcc / config / divmod.c
1 long udivmodsi4 ();
2
3 long
4 __divsi3 (long a, long b)
5 {
6   int neg = 0;
7   long res;
8
9   if (a < 0)
10     {
11       a = -a;
12       neg = !neg;
13     }
14
15   if (b < 0)
16     {
17       b = -b;
18       neg = !neg;
19     }
20
21   res = udivmodsi4 (a, b, 0);
22
23   if (neg)
24     res = -res;
25
26   return res;
27 }
28
29 long
30 __modsi3 (long a, long b)
31 {
32   int neg = 0;
33   long res;
34
35   if (a < 0)
36     {
37       a = -a;
38       neg = 1;
39     }
40
41   if (b < 0)
42     b = -b;
43
44   res = udivmodsi4 (a, b, 1);
45
46   if (neg)
47     res = -res;
48
49   return res;
50 }