Re: 64-bit math in the kernel

H. Peter Anvin (hpa@transmeta.com)
20 Nov 1996 02:56:28 GMT


Followup to: <199611150027.TAA11071@denali.ccs.neu.edu>
By author: Albert Cahalan <albert@ccs.neu.edu>
In newsgroup: linux.dev.kernel
>
> What is the best way to divide a __u64 by a __u32 in the kernel?
> The result will fit in a __u32.
>

There is no way to express that in C, but the x86 DIV instruction will
do exactly that. It sounds like adding some inline assembly functions
(which needs to go into include/asm-* and need equivalents for all
architectures) probably is in order.

Furthermore, it might be worthwhile to provide the equivalent of
libgcc in the kernel.

-hpa

-- 
Not speaking for Transmeta in any way, shape or form.