From 360c4d1554ce9369ce5f54c9975ba4d348c996ef Mon Sep 17 00:00:00 2001 From: Nekotekina Date: Fri, 18 Dec 2020 10:01:26 +0300 Subject: [PATCH] Simplify f16 type --- rpcs3/stdafx.cpp | 2 ++ rpcs3/util/types.hpp | 5 +---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/rpcs3/stdafx.cpp b/rpcs3/stdafx.cpp index 6a4bceaab6..b23dfd4883 100644 --- a/rpcs3/stdafx.cpp +++ b/rpcs3/stdafx.cpp @@ -6,6 +6,8 @@ static_assert(std::endian::native == std::endian::little || std::endian::native CHECK_SIZE_ALIGN(u128, 16, 16); CHECK_SIZE_ALIGN(s128, 16, 16); +CHECK_SIZE_ALIGN(f16, 2, 2); + static_assert(be_t(1) + be_t(2) + be_t(3) == 6); static_assert(le_t(1) + le_t(2) + le_t(3) == 6); diff --git a/rpcs3/util/types.hpp b/rpcs3/util/types.hpp index 3cc9729d7c..74efcd0174 100644 --- a/rpcs3/util/types.hpp +++ b/rpcs3/util/types.hpp @@ -573,10 +573,9 @@ constexpr inline struct umax_helper using f32 = float; using f64 = double; -union alignas(2) f16 +struct f16 { u16 _u16; - u8 _u8[2]; explicit f16(u16 raw) { @@ -595,8 +594,6 @@ union alignas(2) f16 } }; -CHECK_SIZE_ALIGN(f16, 2, 2); - template ::value && std::is_unsigned::value>> constexpr T align(T value, ullong align) {