[lkml]   [1996]   [Nov]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Subject64-bit math in the kernel

What is the best way to divide a __u64 by a __u32 in the kernel?
The result will fit in a __u32.

It seems gcc requires libgcc to do that, but libgcc is not available.
Right now the code casts to a double, but it is not good to use the
FPU in the kernel. I do have a disgusting hack that does the job in
4 divisions and 3 multiplications (hmmm, is div() available?), but
the hack takes almost 4 times as long on a Pentium.

Just how bad are FPU operations in the kernel? I seem to remember
that the FPU memcpy patch had to take special precautions to avoid
corrupting data.

 \ /
  Last update: 2005-03-22 13:38    [W:0.068 / U:0.420 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site