Re: [PATCH] lib/div64: off by one in shift

2019-01-29 Thread Stanislaw Gruszka
On Mon, Jan 28, 2019 at 09:45:03AM -0800, Andrew Morton wrote: > On Mon, 28 Jan 2019 15:49:04 +0100 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 from > > divisor, what cause

Re: [PATCH] lib/div64: off by one in shift

2019-01-28 Thread Andrew Morton
On Mon, 28 Jan 2019 15:49:04 +0100 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 from > divisor, what cause function incorect results with some numbers. > > Corrected code was tested

Re: [PATCH] lib/div64: off by one in shift

2019-01-28 Thread Oleg Nesterov
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

[PATCH] lib/div64: off by one in shift

2019-01-28 Thread Stanislaw Gruszka
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 from divisor, what cause function incorect results with some numbers. Corrected code was tested in user-space, see bugzilla: