mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[String.Index] Restore compound offsets.
Move the shifts to index creation time rather than index comparison time. This seems to benefit micro benchmarks and cover up inefficiencies in our generic index distance calculations.
This commit is contained in:
@@ -527,7 +527,7 @@ extension String.UnicodeScalarView {
|
||||
if i == startIndex || i == endIndex {
|
||||
return true
|
||||
}
|
||||
if i._transcodedOffset != 0 { return false }
|
||||
if i.transcodedOffset != 0 { return false }
|
||||
let i2 = _toCoreIndex(i)
|
||||
if _fastPath(!UTF16.isTrailSurrogate(_guts[i2])) { return true }
|
||||
return i2 == 0 || !UTF16.isLeadSurrogate(_guts[i2 &- 1])
|
||||
|
||||
Reference in New Issue
Block a user