Skip to content

Commit d8f25be

Browse files
committed
[string] Skip unnecessary self UTF-16 length in isEqual
For isEqual bridging comparisons, skip checking our own UTF-16 length when the string we're comparing against is known to be ASCII.
1 parent 7ff3ecf commit d8f25be

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

stdlib/public/core/StringUTF16View.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,7 @@ extension String.UTF16View: BidirectionalCollection {
146146
// For a BMP scalar (1-3 UTF-8 code units), advance past it. For a non-BMP
147147
// scalar, use a transcoded offset first.
148148

149-
// TODO: do the ugly if non-transcoded make sure to scalar align thing...
150-
// Also, can we just jump ahead 4 is transcoded is 1?
149+
// TODO: If transcoded is 1, can we just skip ahead 4?
151150

152151
let idx = _utf16AlignNativeIndex(idx)
153152
let len = _guts.fastUTF8ScalarLength(startingAt: idx._encodedOffset)

0 commit comments

Comments
 (0)