Re: unresolved symbols __udivdi3 and __umoddi3

Tim Schmielau (tim@physik3.uni-rostock.de)
Mon, 28 Jan 2002 18:38:45 +0100 (CET)


> > If 64-bit arithmetics cannot be avoided, the do_div64() macro defined in
> > include/asm/div64.h comes in handy.
> > mod = do_div((unsigned long) x, (long) y)
> > will set x to the quotient x/y and mod to the remainder x%y .
>
> I have looked at this header file and I do not understand the asm
> syntax.
>
> In particular the only x86 div instruction I know only returns a 32 bit
> div result. Because I don't understand the div64 header I cannot
> see how a 64 bit result is calculated.
>

Sorry, there are (platform-dependent) restrictions that I forgot to
mention. I think do_div(x,y) should work for all platforms if
y < 2^16 and x/y < 2^32, but I may stand corrected.

Actually, Momchil Velikov just pointed out that some archs only do 32 bit
divs in do_div64, where at least the C code from asm-parisc/div64.h
should be used.

Tim

-
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/