Skip to content

Commit

Permalink
fix(mask): narrow codegen hack to VS2017 and earlier
Browse files Browse the repository at this point in the history
Fixes #84
  • Loading branch information
nfrechette committed Oct 29, 2023
1 parent d8825c3 commit 228c2c4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions includes/rtm/impl/mask_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,12 +199,12 @@ namespace rtm
#if defined(RTM_SSE2_INTRINSICS)
//////////////////////////////////////////////////////////////////////////
// HACK ALERT!
// VS2015, VS2017, and VS2019 crash when compiling with _mm_set_epi64x() here.
// VS2015 and VS2017 crash when compiling with _mm_set_epi64x() here.
// To work around this, we use alternative code. We assume that the high and low words
// are identical in the mask, which should be true.
// See: https://github.com/nfrechette/rtm/issues/84
//////////////////////////////////////////////////////////////////////////
#if defined(RTM_COMPILER_MSVC) && defined(RTM_ARCH_X86) && !defined(NDEBUG)
#if defined(RTM_COMPILER_MSVC) && RTM_COMPILER_MSVC < RTM_COMPILER_MSVC_2019 && defined(RTM_ARCH_X86) && !defined(NDEBUG)
const uint32_t x_mask = x ? 0xFFFFFFFFU : 0;
const uint32_t y_mask = y ? 0xFFFFFFFFU : 0;
const uint32_t z_mask = z ? 0xFFFFFFFFU : 0;
Expand All @@ -224,12 +224,12 @@ namespace rtm
#if defined(RTM_SSE2_INTRINSICS)
//////////////////////////////////////////////////////////////////////////
// HACK ALERT!
// VS2015, VS2017, and VS2019 crash when compiling with _mm_set_epi64x() here.
// VS2015 and VS2017 crash when compiling with _mm_set_epi64x() here.
// To work around this, we use alternative code. We assume that the high and low words
// are identical in the mask, which should be true.
// See: https://github.com/nfrechette/rtm/issues/84
//////////////////////////////////////////////////////////////////////////
#if defined(RTM_COMPILER_MSVC) && defined(RTM_ARCH_X86) && !defined(NDEBUG)
#if defined(RTM_COMPILER_MSVC) && RTM_COMPILER_MSVC < RTM_COMPILER_MSVC_2019 && defined(RTM_ARCH_X86) && !defined(NDEBUG)
const uint32_t x_mask = x ? 0xFFFFFFFFU : 0;
const uint32_t y_mask = y ? 0xFFFFFFFFU : 0;
const uint32_t z_mask = z ? 0xFFFFFFFFU : 0;
Expand Down

0 comments on commit 228c2c4

Please sign in to comment.