diff options
author | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-11-30 08:25:59 +0000 |
---|---|---|
committer | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-11-30 08:25:59 +0000 |
commit | a8bda0a129c4d74b7a99f2a57a0de7559e5567e0 (patch) | |
tree | 7441c7d8a77c3e8620a3862b2da31c90152db14c /gcc/config/divmod.c | |
parent | f3573c9afb52dbe80276ce2300e4713fcacae1c3 (diff) | |
download | ppe42-gcc-a8bda0a129c4d74b7a99f2a57a0de7559e5567e0.tar.gz ppe42-gcc-a8bda0a129c4d74b7a99f2a57a0de7559e5567e0.zip |
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@37868 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/divmod.c')
-rw-r--r-- | gcc/config/divmod.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/gcc/config/divmod.c b/gcc/config/divmod.c new file mode 100644 index 00000000000..6faa09102b5 --- /dev/null +++ b/gcc/config/divmod.c @@ -0,0 +1,50 @@ +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; +} |