Messages in this thread | | | Date | Thu, 29 Feb 2024 17:01:43 -0800 | From | "H. Peter Anvin" <> | Subject | RE: [PATCH] x86/apic: Use div64_ul() instead of do_div() |
| |
>> >> Change deltapm to unsigned long and replace do_div() with div64_ul() >> which doesn't implicitly cast the divisor and doesn't unnecessarily >> calculate the remainder. > >Eh? they are entirely different beasts. > >do_div() does a 64 by 32 divide that gives a 32bit quotient. >div64_ul() does a much more expensive 64 by 64 divide that >can generate a 64bit quotient. > >The remainder is pretty much free in both cases. >If a cpu has a divide instruction it will almost certainly >put the result in one register and the quotient in another. >
Not on e.g. RISC-V.
| |