From d9d59bc1f4cc50518f31e478d10b10f32203a03b Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sat, 18 May 2019 15:03:15 -0400 Subject: [PATCH] common/cast_util: Declare BitCast and BitCastPointee with the noexcept specifier std::bit_cast is also defined with the noexcept specifier, so we can do the same here to match up with it and stay similar with the standard library. --- src/common/cast_util.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/cast_util.h b/src/common/cast_util.h index 0bed4b65..3033a2b0 100644 --- a/src/common/cast_util.h +++ b/src/common/cast_util.h @@ -13,7 +13,7 @@ namespace Dynarmic::Common { /// Reinterpret objects of one type as another by bit-casting between object representations. template -inline Dest BitCast(const Source& source) { +inline Dest BitCast(const Source& source) noexcept { static_assert(sizeof(Dest) == sizeof(Source), "size of destination and source objects must be equal"); static_assert(std::is_trivially_copyable_v, "destination type must be trivially copyable."); static_assert(std::is_trivially_copyable_v, "source type must be trivially copyable"); @@ -26,7 +26,7 @@ inline Dest BitCast(const Source& source) { /// Reinterpret objects of any arbitrary type as another type by bit-casting between object representations. /// Note that here we do not verify if source has enough bytes to read from. template -inline Dest BitCastPointee(const SourcePtr source) { +inline Dest BitCastPointee(const SourcePtr source) noexcept { static_assert(sizeof(SourcePtr) == sizeof(void*), "source pointer must have size of a pointer"); static_assert(std::is_trivially_copyable_v, "destination type must be trivially copyable.");