Messages in this thread | | | Date | Mon, 28 Jan 2019 18:35:09 +0100 | From | Oleg Nesterov <> | Subject | Re: [PATCH] lib/div64: off by one in shift |
| |
On 01/28, Stanislaw Gruszka wrote: > > fls counts bits starting from 1 to 32 (returns 0 for zero argument). > If we add 1 we shift right one bit more and loose precision
I forgot everything about this code, but I think this patch must be correct,
divisor >> n;
should have MSB == 1 or we loose the precision... Heh, I managed to find the initial version of this code, see
https://lore.kernel.org/lkml/20101014121159.GA407@redhat.com/
and note that it uses __fls(), not fls()! I didn't notice the final version replaced __fls() with fls() which is __fls() + 1 if arg != 0.
Acked-by: Oleg Nesterov <oleg@redhat.com>
| |