Commit 6e58e89b authored by REDMOND\acoates's avatar REDMOND\acoates Committed by Facebook Github Bot

Build fix for latest version of MSVC (#1234)

Summary:
Newest builds of MSVC have a few more builtin's supported, so those polyfills need to be removed when using newer builds of MSVC.
Pull Request resolved: https://github.com/facebook/folly/pull/1234

Reviewed By: Orvid

Differential Revision: D17649918

Pulled By: yfeldblum

fbshipit-source-id: 6c0fbd25bc77000228439a2ad1d66c815cb9f2c1
parent f2986876
...@@ -41,6 +41,7 @@ FOLLY_ALWAYS_INLINE void __builtin___clear_cache(char* begin, char* end) { ...@@ -41,6 +41,7 @@ FOLLY_ALWAYS_INLINE void __builtin___clear_cache(char* begin, char* end) {
} }
} }
#if !defined(_MSC_VER) || (_MSC_VER < 1923)
FOLLY_ALWAYS_INLINE int __builtin_clz(unsigned int x) { FOLLY_ALWAYS_INLINE int __builtin_clz(unsigned int x) {
unsigned long index; unsigned long index;
return int(_BitScanReverse(&index, (unsigned long)x) ? 31 - index : 32); return int(_BitScanReverse(&index, (unsigned long)x) ? 31 - index : 32);
...@@ -92,6 +93,7 @@ FOLLY_ALWAYS_INLINE int __builtin_ctzll(unsigned long long x) { ...@@ -92,6 +93,7 @@ FOLLY_ALWAYS_INLINE int __builtin_ctzll(unsigned long long x) {
return int(_BitScanForward64(&index, x) ? index : 64); return int(_BitScanForward64(&index, x) ? index : 64);
} }
#endif #endif
#endif // !defined(_MSC_VER) || (_MSC_VER < 1923)
FOLLY_ALWAYS_INLINE int __builtin_ffs(int x) { FOLLY_ALWAYS_INLINE int __builtin_ffs(int x) {
unsigned long index; unsigned long index;
...@@ -117,12 +119,15 @@ FOLLY_ALWAYS_INLINE int __builtin_popcount(unsigned int x) { ...@@ -117,12 +119,15 @@ FOLLY_ALWAYS_INLINE int __builtin_popcount(unsigned int x) {
return int(__popcnt(x)); return int(__popcnt(x));
} }
#if !defined(_MSC_VER) || (_MSC_VER < 1923)
FOLLY_ALWAYS_INLINE int __builtin_popcountl(unsigned long x) { FOLLY_ALWAYS_INLINE int __builtin_popcountl(unsigned long x) {
static_assert(sizeof(x) == 4, ""); static_assert(sizeof(x) == 4, "");
return int(__popcnt(x)); return int(__popcnt(x));
} }
#endif // !defined(_MSC_VER) || (_MSC_VER < 1923)
#endif #endif
#if !defined(_MSC_VER) || (_MSC_VER < 1923)
#if defined(_M_IX86) #if defined(_M_IX86)
FOLLY_ALWAYS_INLINE int __builtin_popcountll(unsigned long long x) { FOLLY_ALWAYS_INLINE int __builtin_popcountll(unsigned long long x) {
return int(__popcnt((unsigned int)(x >> 32))) + return int(__popcnt((unsigned int)(x >> 32))) +
...@@ -133,6 +138,7 @@ FOLLY_ALWAYS_INLINE int __builtin_popcountll(unsigned long long x) { ...@@ -133,6 +138,7 @@ FOLLY_ALWAYS_INLINE int __builtin_popcountll(unsigned long long x) {
return int(__popcnt64(x)); return int(__popcnt64(x));
} }
#endif #endif
#endif // !defined(_MSC_VER) || (_MSC_VER < 1923)
FOLLY_ALWAYS_INLINE void* __builtin_return_address(unsigned int frame) { FOLLY_ALWAYS_INLINE void* __builtin_return_address(unsigned int frame) {
// I really hope frame is zero... // I really hope frame is zero...
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment