Wanderer/Info: fix compilation
[AROS.git] / arch / .unmaintained / m68k-linux / utility / sdivmod32.s
blob8950c1826f0d73fbdc3ba947ea2d6e4a65f5a645
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: signed 32 bit division/modulus functions for m68k
6 Lang: english
7 */
9 #include "machine.i"
11 .text
12 .balign 16
13 .globl AROS_SLIB_ENTRY(SDivMod32,Utility)
14 .globl AROS_SLIB_ENTRY(SDivMod32_020,Utility)
16 /* Needed for SDivMod32 */
17 .globl AROS_SLIB_ENTRY(UDivMod32,Utility)
19 .type AROS_SLIB_ENTRY(SDivMod32,Utility),@function
20 .type AROS_SLIB_ENTRY(SDivMod32_020,Utility),@function
22 AROS_SLIB_ENTRY(SDivMod32_020,Utility):
23 divsl.l %d1,%d1:%d0
24 rts
26 /* All we do is remember the sign and get UDivMod32 to do all the work,
27 this is actually a bit harder than just changing both, doing the
28 division and then changing the other...
30 If both are positive, do nothing,
31 if one is negative, change both,
32 if both are negative, change remainder
34 AROS_SLIB_ENTRY(SDivMod32,Utility):
35 tst.l %d0
36 jbpl .nispos
37 neg.l %d0
38 tst.l %d1
39 jbpl .nisneg
40 neg.l %d1
41 jbsr AROS_SLIB_ENTRY(UDivMod32,Utility)
42 neg.l %d1
43 rts
44 .nisneg:
45 jbsr AROS_SLIB_ENTRY(UDivMod32,Utility)
46 neg.l %d1
47 neg.l %d0
48 rts
49 .nispos:
50 tst.l %d1
51 jbpl AROS_SLIB_ENTRY(UDivMod32,Utility)
52 neg.l %d1
53 jbsr AROS_SLIB_ENTRY(UDivMod32,Utility)
54 neg.l %d0
55 rts