>
> matti.aarnio@zmailer.org said:
> > To think of it, there really should be explicitely callable
> > versions of these with LinuxKernel names for them, not gcc
> > builtins. That way people would *know* they are doing
> > something, which is potentially very slow.
> > (And the API would not change from underneath them.)
>
> Like include/asm-*/div64.h::do_div()?
>
Some, perhaps all, of the recent requirements for a 64 bit division
can be handled with the (Intel) 32-bit division because only the
dividend is 64 bits, and the division can be unsigned, i.e.
HIGHLONG = 0x08 ; Depends upon caller's stack.
LOWLONG = 0x0C
DIVISOR = 0x10
movl HIGHLONG(%esp), %edx
movl LOWLLONG(%esp), %eax
movl DIVISOR(%esp), %ecx
divl %ecx,%eax
... returns a longword in %eax
This could be an __inline__ function. Most other stuff can be reduced
with shifts before a 32-bit divide.
64 bit signed division is a bitch in any 32-bit machine because it's
done just line 4th grade long division. There are remainders that have
to carried, etc.
Cheers,
Dick Johnson
Penguin : Linux version 2.4.1 on an i686 machine (799.53 BogoMips).
"Memory is like gasoline. You use it up when you are running. Of
course you get it all back when you reboot..."; Actual explanation
obtained from the Micro$oft help desk.
-
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/