From a51edca795e69686d89c779e52edef38f15792a2 Mon Sep 17 00:00:00 2001 From: Markus Gans Date: Tue, 17 Dec 2024 00:12:47 +0100 Subject: [PATCH] Some optimizations --- final/ftypes.h | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/final/ftypes.h b/final/ftypes.h index 2fbbbdcc..99ff5c8e 100644 --- a/final/ftypes.h +++ b/final/ftypes.h @@ -301,7 +301,7 @@ struct FCharAttribute uInt8 : 8; // padding byte }; -#if HAVE_BUILTIN(__builtin_bit_cast) + constexpr auto FCharAttribute_to_uInt32 (const finalcut::FCharAttribute& fchar_attr) -> uInt32 { return uInt32(fchar_attr.bold) << 0U @@ -331,15 +331,6 @@ constexpr auto getFAttributeByte ( const FCharAttribute& fchar_attr { return (FCharAttribute_to_uInt32(fchar_attr) >> (index << 3)) & 0xff; } -#else -inline auto getFAttributeByte ( const FCharAttribute& fchar_attr - , std::size_t index ) noexcept -> uInt8 -{ - uInt8 byte{}; - std::memcpy (&byte, reinterpret_cast(&fchar_attr) + index, sizeof(uInt8)); - return byte; -} -#endif #if HAVE_BUILTIN(__builtin_bit_cast) constexpr auto setFAttributeByte ( FCharAttribute& fchar_attr @@ -431,7 +422,7 @@ inline auto isFUnicodeEqual (const FUnicode& lhs, const FUnicode& rhs) noexcept constexpr auto getCompareBitMask() noexcept -> uInt32 { constexpr const FAttribute mask {{ 0xff, 0xff, 0x04, 0x00 }}; - return FCharAttribute_to_uInt32(mask.bit); + return __builtin_bit_cast(uInt32, mask.byte); } #else inline auto getCompareBitMask() noexcept -> uInt32