about 64-bits division in kernel

loody miloody at gmail.com
Thu May 19 23:34:11 EDT 2011


hi all:
My platform is 32-bits cpu and I need following calculation in my driver.
#define longdiv(sr1, sr2, div)      (unsigned long )((((unsigned long
long)(sr1) << 32) ^ (sr2)) / (div))

my question are:
1. why "__udivdi3" has any relationship with above calculation?
2. I know the above calculation is implemented in clibc, but why
kernel still implement itself?
     why kernel try to make another wheel instead of including what
clib provided ?

-- 
Regards,



More information about the Kernelnewbies mailing list