diff options
author | Stephane Carrez <Stephane.Carrez@worldnet.fr> | 2000-11-30 08:25:59 +0000 |
---|---|---|
committer | Jeffrey A Law <law@cygnus.com> | 2000-11-30 08:25:59 +0000 |
commit | 51dca127df63c518e0aca8f0f88f5a21cedf2554 (patch) | |
tree | 7441c7d8a77c3e8620a3862b2da31c90152db14c /gcc/config/udivmodsi4.c | |
parent | dd7e09b22cdd8a500f9ba83348472a63b5b1bd51 (diff) |
* 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: https://gcc.gnu.org/svn/gcc/trunk@37868 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/udivmodsi4.c')
-rw-r--r-- | gcc/config/udivmodsi4.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/gcc/config/udivmodsi4.c b/gcc/config/udivmodsi4.c new file mode 100644 index 00000000000..83c2340c2f8 --- /dev/null +++ b/gcc/config/udivmodsi4.c @@ -0,0 +1,24 @@ +unsigned long +udivmodsi4(unsigned long num, unsigned long den, int modwanted) +{ + unsigned long bit = 1; + unsigned long res = 0; + + while (den < num && bit && !(den & (1L<<31))) + { + den <<=1; + bit <<=1; + } + while (bit) + { + if (num >= den) + { + num -= den; + res |= bit; + } + bit >>=1; + den >>=1; + } + if (modwanted) return num; + return res; +} |