lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 21 Dec 2017 14:48:14 +0000
From:   David Laight <David.Laight@...LAB.COM>
To:     'Peter Zijlstra' <>
CC:     'Crt Mori' <>, Jonathan Cameron <>,
        "Ingo Molnar" <>,
        Andrew Morton <>,
        "Kees Cook" <>,
        Rusty Russell <>,
        "Ian Abbott" <>,
        Larry Finger <>,
        "Niklas Soderlund" <>,
        Thomas Gleixner <>,
        Krzysztof Kozlowski <>,
        Masahiro Yamada <>,
        "" <>,
        "" <>,
        Joe Perches <>
Subject: RE: [PATCH v10 1/3] lib: Add strongly typed 64bit int_sqrt

From: Peter Zijlstra
> Sent: 21 December 2017 14:12
> > > This part above looks like FLS
> > It also does the rest of the required shifts.
> Still, fls() + shift is way faster on hardware that has an fls
> instruction.
> Writing out that binary search doesn't make sense.

If the hardware doesn't have an appropriate fls instruction
the soft fls()will be worse.

If you used fls() you'd still need quite a bit of code
to generate the correct shift and loop count adjustment.
Given the cost of the loop iterations the 3 tests are noise.
The open coded version is obviously correct...

I didn't add the 4th one because the code always does 2 iterations.

If you were really worried about performance there are faster
algorithms (even doing 2 or 4 bits a time is faster).


Powered by blists - more mailing lists