@@ -155,76 +155,6 @@ class ASCIICollation {
155
155
ASCIICollation (const ASCIICollation &) = delete ;
156
156
};
157
157
158
- // / Compares the strings via the Unicode Collation Algorithm on the root locale.
159
- // / Results are the usual string comparison results:
160
- // / <0 the left string is less than the right string.
161
- // / ==0 the strings are equal according to their collation.
162
- // / >0 the left string is greater than the right string.
163
- int32_t
164
- swift::_swift_stdlib_unicode_compare_utf16_utf16 (const uint16_t *LeftString,
165
- int32_t LeftLength,
166
- const uint16_t *RightString,
167
- int32_t RightLength) {
168
- // ICU UChar type is platform dependent. In Cygwin, it is defined
169
- // as wchar_t which size is 2. It seems that the underlying binary
170
- // representation is same with swift utf16 representation.
171
- // On Clang 4.0 under a recent Linux, ICU uses the built-in char16_t type.
172
- return ucol_strcoll (GetRootCollator (),
173
- reinterpret_cast <const UChar *>(LeftString), LeftLength,
174
- reinterpret_cast <const UChar *>(RightString), RightLength);
175
- }
176
-
177
- // / Compares the strings via the Unicode Collation Algorithm on the root locale.
178
- // / Results are the usual string comparison results:
179
- // / <0 the left string is less than the right string.
180
- // / ==0 the strings are equal according to their collation.
181
- // / >0 the left string is greater than the right string.
182
- int32_t
183
- swift::_swift_stdlib_unicode_compare_utf8_utf16 (const unsigned char *LeftString,
184
- int32_t LeftLength,
185
- const uint16_t *RightString,
186
- int32_t RightLength) {
187
- UCharIterator LeftIterator;
188
- UCharIterator RightIterator;
189
- UErrorCode ErrorCode = U_ZERO_ERROR;
190
-
191
- uiter_setUTF8 (&LeftIterator, reinterpret_cast <const char *>(LeftString), LeftLength);
192
- uiter_setString (&RightIterator, reinterpret_cast <const UChar *>(RightString),
193
- RightLength);
194
-
195
- uint32_t Diff = ucol_strcollIter (GetRootCollator (),
196
- &LeftIterator, &RightIterator, &ErrorCode);
197
- if (U_FAILURE (ErrorCode)) {
198
- swift::crash (" ucol_strcollIter: Unexpected error doing utf8<->utf16 string comparison." );
199
- }
200
- return Diff;
201
- }
202
-
203
- // / Compares the strings via the Unicode Collation Algorithm on the root locale.
204
- // / Results are the usual string comparison results:
205
- // / <0 the left string is less than the right string.
206
- // / ==0 the strings are equal according to their collation.
207
- // / >0 the left string is greater than the right string.
208
- int32_t
209
- swift::_swift_stdlib_unicode_compare_utf8_utf8 (const unsigned char *LeftString,
210
- int32_t LeftLength,
211
- const unsigned char *RightString,
212
- int32_t RightLength) {
213
- UCharIterator LeftIterator;
214
- UCharIterator RightIterator;
215
- UErrorCode ErrorCode = U_ZERO_ERROR;
216
-
217
- uiter_setUTF8 (&LeftIterator, reinterpret_cast <const char *>(LeftString), LeftLength);
218
- uiter_setUTF8 (&RightIterator, reinterpret_cast <const char *>(RightString), RightLength);
219
-
220
- uint32_t Diff = ucol_strcollIter (GetRootCollator (),
221
- &LeftIterator, &RightIterator, &ErrorCode);
222
- if (U_FAILURE (ErrorCode)) {
223
- swift::crash (" ucol_strcollIter: Unexpected error doing utf8<->utf8 string comparison." );
224
- }
225
- return Diff;
226
- }
227
-
228
158
void *swift::_swift_stdlib_unicodeCollationIterator_create (
229
159
const __swift_uint16_t *Str, __swift_uint32_t Length) {
230
160
UErrorCode ErrorCode = U_ZERO_ERROR;
0 commit comments