summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShoaib Meenai <smeenai@fb.com>2017-12-05 17:46:23 +0000
committerShoaib Meenai <smeenai@fb.com>2017-12-05 17:46:23 +0000
commit54b78ffabb0f98bbb22eabeeb53bea86fd4ed2c0 (patch)
treef5161d5cb1ae53e2b80dbc5186b3ffdbab4a8f0b
parentab7cb215b02c3246f565d7a16c13880ec188f041 (diff)
[libcxx] Fix intrinsics for MSVC
The parameter was previously renamed but MSVC path was not updated. Patch by Andrey Khalyavin. Differential Revision: https://reviews.llvm.org/D40774 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@319802 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/algorithm16
1 files changed, 8 insertions, 8 deletions
diff --git a/include/algorithm b/include/algorithm
index 8f6938dcd..35c6129ea 100644
--- a/include/algorithm
+++ b/include/algorithm
@@ -797,7 +797,7 @@ unsigned __ctz(unsigned __x) {
unsigned long where;
// Search from LSB to MSB for first set bit.
// Returns zero if no set bit is found.
- if (_BitScanForward(&where, mask))
+ if (_BitScanForward(&where, __x))
return where;
return 32;
#endif
@@ -823,15 +823,15 @@ unsigned long long __ctz(unsigned long long __x) {
// Returns zero if no set bit is found.
#if defined(_LIBCPP_HAS_BITSCAN64)
(defined(_M_AMD64) || defined(__x86_64__))
- if (_BitScanForward64(&where, mask))
+ if (_BitScanForward64(&where, __x))
return static_cast<int>(where);
#else
// Win32 doesn't have _BitScanForward64 so emulate it with two 32 bit calls.
// Scan the Low Word.
- if (_BitScanForward(&where, static_cast<unsigned long>(mask)))
+ if (_BitScanForward(&where, static_cast<unsigned long>(__x)))
return where;
// Scan the High Word.
- if (_BitScanForward(&where, static_cast<unsigned long>(mask >> 32)))
+ if (_BitScanForward(&where, static_cast<unsigned long>(__x >> 32)))
return where + 32; // Create a bit offset from the LSB.
#endif
return 64;
@@ -849,7 +849,7 @@ unsigned __clz(unsigned __x) {
unsigned long where;
// Search from LSB to MSB for first set bit.
// Returns zero if no set bit is found.
- if (_BitScanReverse(&where, mask))
+ if (_BitScanReverse(&where, __x))
return 31 - where;
return 32; // Undefined Behavior.
#endif
@@ -874,14 +874,14 @@ unsigned long long __clz(unsigned long long __x) {
// BitScanReverse scans from MSB to LSB for first set bit.
// Returns 0 if no set bit is found.
#if defined(_LIBCPP_HAS_BITSCAN64)
- if (_BitScanReverse64(&where, mask))
+ if (_BitScanReverse64(&where, __x))
return static_cast<int>(63 - where);
#else
// Scan the high 32 bits.
- if (_BitScanReverse(&where, static_cast<unsigned long>(mask >> 32)))
+ if (_BitScanReverse(&where, static_cast<unsigned long>(__x >> 32)))
return 63 - (where + 32); // Create a bit offset from the MSB.
// Scan the low 32 bits.
- if (_BitScanReverse(&where, static_cast<unsigned long>(mask)))
+ if (_BitScanReverse(&where, static_cast<unsigned long>(__x)))
return 63 - where;
#endif
return 64; // Undefined Behavior.