Messages in this thread | | | Date | Fri, 08 Feb 2002 20:04:29 +0100 | From | Roman Zippel <> | Subject | Re: [PATCH] bring sanity to div64.h and do_div usage |
| |
Hi,
Troy Benjegerdes wrote:
> +#else /* USE_SLOW_64BIT_DIVIDES */ > + /* > + * Nasty ugly generic C 64 bit divide on 32 bit machine > + * No one seems to want to take credit for this > + */ > + unsigned long low, low2, high; > + low = (t) & 0xffffffff; > + high = (t) >> 32; > + res = high % base; > + high = high / base; > + low2 = low >> 16; > + low2 += res << 16; > + res = low2 % base; > + low2 = low2 / base; > + low = low & 0xffff; > + low += res << 16; > + res = low % base; > + low = low / base; > + t = low + ((long long)low2 << 16) + > + ((long long) high << 32);
IMO this is large enough to put under lib/..., the rest could also be put into asm-generic, from where the archs could include it, this would avoid this:
> +#ifdef __USE_ASM > +/* yeah, this is a mess, and leaves out m68k.... */ > +# if defined(CONFIG_X86) || define(CONFIG_ARCH_S390) || defined(CONFIG_MIPS) > +# define __USE_ASM__ > +# endif > +#endif
bye, Roman
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |