diff --git a/src/intl/lc_narrow.cpp b/src/intl/lc_narrow.cpp index fc12fac84a..f4e4943e4d 100644 --- a/src/intl/lc_narrow.cpp +++ b/src/intl/lc_narrow.cpp @@ -767,7 +767,7 @@ ULONG LC_NARROW_canonical(texttype* obj, ULONG srcLen, const UCHAR* src, ULONG d if ((impl->texttype_flags & (TEXTTYPE_secondary_insensitive | TEXTTYPE_tertiary_insensitive)) == 0) { - put(dst, (USHORT) ((primary << 8) | (coll->Secondary << 4) | coll->Tertiary)); + put(dst, (USHORT) ((primary << 8) | (coll->Secondary << SortOrderTblEntrySecondaryBits) | coll->Tertiary)); } else if ((impl->texttype_flags & TEXTTYPE_secondary_insensitive) == 0) { diff --git a/src/intl/ld.h b/src/intl/ld.h index 5fe70e2508..0ee001f733 100644 --- a/src/intl/ld.h +++ b/src/intl/ld.h @@ -215,14 +215,15 @@ //----------------------------------------------------------------- */ -struct SortOrderTblEntry { +static const unsigned SortOrderTblEntrySecondaryBits = 5; +struct SortOrderTblEntry { + // It's important that Secondary + Tertiary fits in a byte. UINT16 Primary:8; - UINT16 Secondary:4; - UINT16 Tertiary:2; + UINT16 Secondary:5; // SortOrderTblEntrySecondaryBits + UINT16 Tertiary:3; UINT16 IsExpand:1; UINT16 IsCompress:1; - }; /*