REDIVIVUS

Proposals / #1381

Use signed ordering results for both wide-string comparison pairs

checked · by eejitgames · submitted 2026-11-07

STRING_CompareWideStrings (win005264f0/mac002b9e1c) and UNICODE_CompareWideStringsNNoCase (win00526610/mac002b9f3a) declare uint32_t results. Their complete bodies encode lower/equal/higher character order as 0xffffffff/0/1. Recover int32_t so the lower outcome is represented as -1 rather than an unsigned maximum. This is a semantic inference from the native three-way ordering map: all12 direct call sites only test zero, so they do not independently prove signedness and no caller behavior improvement is claimed. Full-width EAX is defined on every exit; Windows/Mac pair algorithms agree. Change only these four result types, preserving unsigned WORD character ordering, inputs, names and each build's ABI. Sibling comparison routines are already signed; no sibling edits are proposed.

Changes 4, applied together

  1. Set prototype win 0x005264f0

    signatureuint32_t STRING_CompareWideStrings(WCHAR * wszText1, WCHAR * wszText2)→int32_t STRING_CompareWideStrings(WCHAR * wszText1, WCHAR * wszText2)
    convention__fastcall
  2. Set prototype mac 0x002b9e1c

    signatureuint32_t STRING_CompareWideStrings(WCHAR * wszText1, WCHAR * wszText2)→int32_t STRING_CompareWideStrings(WCHAR * wszText1, WCHAR * wszText2)
    convention__cdecl
  3. Set prototype win 0x00526610

    signatureuint32_t UNICODE_CompareWideStringsNNoCase(ushort * pwszText1, ushort * pwszText2, int32_t nMaxChars)→int32_t UNICODE_CompareWideStringsNNoCase(ushort * pwszText1, ushort * pwszText2, int32_t nMaxChars)
    convention__fastcall
  4. Set prototype mac 0x002b9f3a

    signatureuint32_t UNICODE_CompareWideStringsNNoCase(ushort * pwszText1, ushort * pwszText2, int32_t nMaxChars)→int32_t UNICODE_CompareWideStringsNNoCase(ushort * pwszText1, ushort * pwszText2, int32_t nMaxChars)
    convention__cdecl