diff options
author | Chris Robinson <[email protected]> | 2022-12-18 11:42:39 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2022-12-18 11:42:39 -0800 |
commit | 14d7809a89ea51ca663a7ebf09e7bc135b904d5d (patch) | |
tree | 521c5db30518a4e1f00818e1187e6b8cb3e1899d | |
parent | 465ee8ab23fce3f279e2f5556c7c56e2c6cfe5c8 (diff) |
Change the order of compiler checks in assume_aligned
Testing to see if this works around issues with MSVC builds
-rw-r--r-- | common/opthelpers.h | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/common/opthelpers.h b/common/opthelpers.h index 04c5f1d0..0f05dc3c 100644 --- a/common/opthelpers.h +++ b/common/opthelpers.h @@ -58,15 +58,17 @@ force_inline constexpr auto assume_aligned(T *ptr) noexcept return std::assume_aligned<alignment,T>(ptr); #elif HAS_BUILTIN(__builtin_assume_aligned) return static_cast<T*>(__builtin_assume_aligned(ptr, alignment)); -#elif defined(__ICC) - __assume_aligned(ptr, alignment); - return ptr; -#else +#elif defined(_MSC_VER) constexpr std::size_t alignment_mask{(1<<alignment) - 1}; if((reinterpret_cast<std::uintptr_t>(ptr)&alignment_mask) == 0) return ptr; unreachable(); -#endif +#elif defined(__ICC) + __assume_aligned(ptr, alignment); + return ptr; + #else + return ptr; + #endif } } // namespace al |