lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 1 | |
| 2 | extern unsigned long udivmodsi4(unsigned long num, unsigned long den, int modwanted); |
| 3 | |
| 4 | |
| 5 | long |
| 6 | __divsi3 (long a, long b) |
| 7 | { |
| 8 | int neg = 0; |
| 9 | long res; |
| 10 | |
| 11 | if (a < 0) |
| 12 | { |
| 13 | a = -a; |
| 14 | neg = !neg; |
| 15 | } |
| 16 | |
| 17 | if (b < 0) |
| 18 | { |
| 19 | b = -b; |
| 20 | neg = !neg; |
| 21 | } |
| 22 | |
| 23 | res = udivmodsi4 (a, b, 0); |
| 24 | |
| 25 | if (neg) |
| 26 | res = -res; |
| 27 | |
| 28 | return res; |
| 29 | } |
| 30 | |
| 31 | long |
| 32 | __modsi3 (long a, long b) |
| 33 | { |
| 34 | int neg = 0; |
| 35 | long res; |
| 36 | |
| 37 | if (a < 0) |
| 38 | { |
| 39 | a = -a; |
| 40 | neg = 1; |
| 41 | } |
| 42 | |
| 43 | if (b < 0) |
| 44 | b = -b; |
| 45 | |
| 46 | res = udivmodsi4 (a, b, 1); |
| 47 | |
| 48 | if (neg) |
| 49 | res = -res; |
| 50 | |
| 51 | return res; |
| 52 | } |