Skip to content

Commit 0c0af1a

Browse files
committed
resolves #158
1 parent 895def0 commit 0c0af1a

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

final/ftypes.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ union FAttribute
417417

418418
static constexpr std::size_t UNICODE_MAX = 5;
419419

420-
struct FUnicode
420+
struct alignas(16) FUnicode
421421
{
422422
wchar_t unicode_data[UNICODE_MAX]{L'\0', L'\0', L'\0', L'\0', L'\0'};
423423

@@ -520,8 +520,8 @@ struct FUnicode
520520
friend constexpr auto operator == (const FUnicode& lhs, const FUnicode& rhs) noexcept -> bool
521521
{
522522
#if HAVE_BUILTIN(__builtin_memcmp)
523-
return __builtin_memcmp ( lhs.unicode_data
524-
, rhs.unicode_data
523+
return __builtin_memcmp ( std::begin(lhs.unicode_data)
524+
, std::begin(rhs.unicode_data)
525525
, UNICODE_MAX * sizeof(wchar_t) ) == 0;
526526
#else
527527
for (std::size_t i{0}; i < UNICODE_MAX; ++i)
@@ -540,7 +540,6 @@ struct FUnicode
540540
}
541541
};
542542

543-
static_assert( sizeof(FUnicode) == UNICODE_MAX * sizeof(wchar_t), "Unexpected alignment or padding in FUnicode" );
544543

545544
enum class FColor : uInt16; // forward declaration
546545

@@ -568,7 +567,9 @@ constexpr auto isFUnicodeEqual (const FUnicode& lhs, const FUnicode& rhs) noexce
568567
inline auto isFUnicodeEqual (const FUnicode& lhs, const FUnicode& rhs) noexcept -> bool
569568
{
570569
// Perform a byte-wise comparison
571-
return std::wmemcmp(&lhs.char1, &rhs.char1, UNICODE_MAX) == 0;
570+
return std::equal ( std::begin(lhs.unicode_data)
571+
, std::end(lhs.unicode_data)
572+
, std::begin(rhs.unicode_data) );
572573
}
573574
#endif
574575

0 commit comments

Comments
 (0)