diff options
author | Stephane Carrez <Stephane.Carrez@worldnet.fr> | 2000-11-30 09:25:59 +0100 |
---|---|---|
committer | Jeff Law <law@gcc.gnu.org> | 2000-11-30 01:25:59 -0700 |
commit | 75273d0832af1a5ce7bd23bff7221094e197b8e1 (patch) | |
tree | 7441c7d8a77c3e8620a3862b2da31c90152db14c /gcc/config/udivmodsi4.c | |
parent | 15c2086a04403040aad95867e4a2cf89cc25cd17 (diff) | |
download | gcc-75273d0832af1a5ce7bd23bff7221094e197b8e1.zip gcc-75273d0832af1a5ce7bd23bff7221094e197b8e1.tar.gz gcc-75273d0832af1a5ce7bd23bff7221094e197b8e1.tar.bz2 |
udivmod.c, [...]: Moved from here.
* 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.
From-SVN: r37868
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 0000000..83c2340 --- /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; +} |