Skip to content

Commit

Permalink
Some optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
gansm committed Dec 16, 2024
1 parent 2284550 commit a51edca
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions final/ftypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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<const uInt8*>(&fchar_attr) + index, sizeof(uInt8));
return byte;
}
#endif

#if HAVE_BUILTIN(__builtin_bit_cast)
constexpr auto setFAttributeByte ( FCharAttribute& fchar_attr
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit a51edca

Please # to comment.