Make BitScanForward/BitScanForward64 PAL wrappers branchless. (#20412)
authorJack Pappas <jack-pappas@users.noreply.github.com>
Thu, 1 Nov 2018 05:50:23 +0000 (01:50 -0400)
committerJan Kotas <jkotas@microsoft.com>
Thu, 1 Nov 2018 05:50:23 +0000 (22:50 -0700)
commit6fe7effad7fddf8d5dc0b3ac3d5be5ec80e158ff
treeb8dafadb9aa2c9dcdf77f9dad84d3c79a42dedef
parentd378770b6c21c5b74692cc251a3f8c58b6f377db
Make BitScanForward/BitScanForward64 PAL wrappers branchless. (#20412)

The BitScanForward/BitScanForward64 wrapper functions from the PAL and
gcenv have been modified so they're faster (and branchless), while also
adhering more closely to the behavior of the MSVC intrinsics.

Use _BitScanForward64 when targeting 64-bit Windows.

The _WIN32 macro is always defined by MSVC, even when targeting 64-bit
versions of Windows. Use the _WIN64 macro instead to check whether the
build is targeting 64-bit Windows, and if so, use the _BitScanForward64
intrinsic for the BitScanForward64 wrapper instead of the 32-bit-based
fallback.
src/gc/env/gcenv.base.h
src/pal/inc/pal.h