v8/test/unittests/base
Clemens Hammacher 7d231e576a [bits] Consolidate Count{Leading,Trailing}Zeros
Instead of having one method for 32 bit integers and one for 64 bit,
plus a templatized version to choose from those two, just implement one
version which handles unsigned integers of any size. Also, make them
constexpr.
The Count{Leading,Trailing}Zeros{32,64} methods are kept for now in
order to keep the amount of code changes small. Also, sometimes it
improves readability by stating exactly the size of the argument,
especially for leading zeros (where zero-extending would add more
leading zeros).

CountLeadingZeros now uses a binary search inspired implementation
as proposed in Hacker's Delight. It's more than 20% faster on x64 if
the builtins are disabled.
CountTrailingZeros falls back to CountPopulation instead of counting in
a naive loop. This is ~50% faster.

R=mstarzinger@chromium.org

Change-Id: I1d8bf1d7295b930724163248150444bd17fbb34e
Reviewed-on: https://chromium-review.googlesource.com/741231
Reviewed-by: Michael Starzinger <mstarzinger@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49106}
2017-11-03 14:06:25 +00:00
..
platform Fix common misspellings 2017-08-02 09:35:28 +00:00
utils Move unit tests to test/unittests. 2014-10-01 08:34:25 +00:00
atomic-utils-unittest.cc [base] Add tests for base::AsAtomicWord::SetBits. 2017-08-16 15:13:02 +00:00
bits-unittest.cc [bits] Consolidate Count{Leading,Trailing}Zeros 2017-11-03 14:06:25 +00:00
cpu-unittest.cc [x86] Disable AVX unless the operating system explicitly claims to support it. 2015-01-27 09:59:24 +00:00
division-by-constant-unittest.cc Remove v8stdint.h, it doesn't serve a purpose anymore. 2014-10-21 08:25:14 +00:00
flags-unittest.cc Remove v8stdint.h, it doesn't serve a purpose anymore. 2014-10-21 08:25:14 +00:00
functional-unittest.cc [turbofan] Fix HashCode/Equals for floating point operators. 2014-10-08 07:32:07 +00:00
ieee754-unittest.cc [builtins] Unify most of the remaining Math builtins. 2016-07-01 11:13:02 +00:00
iterator-unittest.cc Avoid signed/unsigned warning in VC++ 2017 builds 2017-04-24 19:29:59 +00:00
logging-unittest.cc [jumbo] add unittests jumbo support 2017-09-28 22:19:40 +00:00
macros-unittest.cc [base] Align the address hint in VirtualMemory. 2017-07-27 13:50:06 +00:00
ostreams-unittest.cc [ostreams] Extend AsHex and add AsHexBytes 2017-07-25 08:37:46 +00:00
sys-info-unittest.cc Remove NaCl support. 2016-07-27 07:50:31 +00:00
template-utils-unittest.cc Allow constexpr RegList construction from Registers 2017-10-24 17:30:11 +00:00