From 6753601b1570876ffa6ac36f8a5fde10c35a9a7c Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sun, 18 Dec 2022 20:25:01 -0800 Subject: Avoid unreachable() in assume_aligned Another test to attempt to workaround MSVC build problems. Also, don't assume bit-wise value alignment for pointers as a default fallback. --- common/opthelpers.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/common/opthelpers.h b/common/opthelpers.h index 04c5f1d0..6b0c8db9 100644 --- a/common/opthelpers.h +++ b/common/opthelpers.h @@ -58,14 +58,16 @@ force_inline constexpr auto assume_aligned(T *ptr) noexcept return std::assume_aligned(ptr); #elif HAS_BUILTIN(__builtin_assume_aligned) return static_cast(__builtin_assume_aligned(ptr, alignment)); +#elif defined(_MSC_VER) + constexpr std::size_t alignment_mask{(1<(ptr)&alignment_mask) == 0) + return ptr; + __assume(0); #elif defined(__ICC) __assume_aligned(ptr, alignment); return ptr; #else - constexpr std::size_t alignment_mask{(1<(ptr)&alignment_mask) == 0) - return ptr; - unreachable(); + return ptr; #endif } -- cgit v1.2.3