Skip to content
This repository has been archived by the owner on Dec 26, 2023. It is now read-only.

Commit

Permalink
test _MSC_VER instead of _WIN32 for stuff specific to Visual Studio (#49
Browse files Browse the repository at this point in the history
)

otherwise, cross-compiling for MingW32 with i686-w64-mingw32-g++-posix
-Werror fails with the following diagnosis

robin_hood.h:116: error: ignoring #pragma intrinsic  [-Werror=unknown-pragmas]
 #    pragma intrinsic(ROBIN_HOOD(BITSCANFORWARD))

But really __builtin_ctzl() is available, since it's GCC.
  • Loading branch information
adl authored and martinus committed Oct 17, 2019
1 parent c9d72bd commit 813dadd
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/include/robin_hood.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
#endif

// endianess
#ifdef _WIN32
#ifdef _MSC_VER
# define ROBIN_HOOD_PRIVATE_DEFINITION_LITTLE_ENDIAN() 1
# define ROBIN_HOOD_PRIVATE_DEFINITION_BIG_ENDIAN() 0
#else
Expand All @@ -92,7 +92,7 @@
#endif

// inline
#ifdef _WIN32
#ifdef _MSC_VER
# define ROBIN_HOOD_PRIVATE_DEFINITION_NOINLINE() __declspec(noinline)
#else
# define ROBIN_HOOD_PRIVATE_DEFINITION_NOINLINE() __attribute__((noinline))
Expand All @@ -106,7 +106,7 @@
#endif

// count leading/trailing bits
#ifdef _WIN32
#ifdef _MSC_VER
# if ROBIN_HOOD(BITNESS) == 32
# define ROBIN_HOOD_PRIVATE_DEFINITION_BITSCANFORWARD() _BitScanForward
# else
Expand Down Expand Up @@ -146,7 +146,7 @@
#endif

// likely/unlikely
#if defined(_WIN32)
#ifdef _MSC_VER
# define ROBIN_HOOD_LIKELY(condition) condition
# define ROBIN_HOOD_UNLIKELY(condition) condition
#else
Expand Down Expand Up @@ -267,7 +267,7 @@ inline uint64_t umul128(uint64_t a, uint64_t b, uint64_t* high) noexcept {
*high = static_cast<uint64_t>(result >> 64U);
return static_cast<uint64_t>(result);
}
#elif (defined(_WIN32) && ROBIN_HOOD(BITNESS) == 64)
#elif (defined(_MSC_VER) && ROBIN_HOOD(BITNESS) == 64)
# define ROBIN_HOOD_PRIVATE_DEFINITION_HAS_UMUL128() 1
# include <intrin.h> // for __umulh
# pragma intrinsic(__umulh)
Expand Down

0 comments on commit 813dadd

Please sign in to comment.