3:31 AM
/// Compares the strings via the Unicode Collation Algorithm on the root locale. /// Results are the usual string comparison results: /// <0 the left string is less than the right string. /// ==0 the strings are equal according to their collation. /// >0 the left string is greater than the right string. int32_t swift::_swift_stdlib_unicode_compare_utf16_utf16(const uint16_t *LeftString, int32_t LeftLength, const uint16_t *RightString, int32_t RightLength) { // ICU UChar type is platform dependent. In Cygwin, it is defined // as wchar_t which size is 2. It seems that the underlying binary // representation is same with swift utf16 representation. // On Clang 4.0 under a recent Linux, ICU uses the built-in char16_t type. return ucol_strcoll(GetRootCollator(), reinterpret_cast<const UChar *>(LeftString), LeftLength, reinterpret_cast<const UChar *>(RightString), RightLength); } (edited)
3:33 AM
他にもutf8まじりのオーバーロードとかったけどutf16同士だとここになる ここでSwiftから見ると C 関数の _swift_stdlib_unicode_compare_utf16_utf16 が C++ で実装されてて ucol_strcoll の呼び出しに帰着してる これは外部のlibicuのシンボルじゃないか (edited)