aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/opthelpers.h10
1 files 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<alignment,T>(ptr);
#elif HAS_BUILTIN(__builtin_assume_aligned)
return static_cast<T*>(__builtin_assume_aligned(ptr, alignment));
+#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;
+ __assume(0);
#elif defined(__ICC)
__assume_aligned(ptr, alignment);
return ptr;
#else
- constexpr std::size_t alignment_mask{(1<<alignment) - 1};
- if((reinterpret_cast<std::uintptr_t>(ptr)&alignment_mask) == 0)
- return ptr;
- unreachable();
+ return ptr;
#endif
}