mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[String] Cleanup normalization code.
Clean up some of the code surrounding the normalized code unit iterator.
This commit is contained in:
@@ -122,7 +122,7 @@ internal func _utf8ScalarLength(_ x: UInt8) -> Int {
|
||||
@inlinable @inline(__always)
|
||||
internal func _utf8ScalarLength(
|
||||
_ utf8: UnsafeBufferPointer<UInt8>, endingAt i: Int
|
||||
) -> Int {
|
||||
) -> Int {
|
||||
var len = 1
|
||||
while _isContinuation(utf8[i &- len]) {
|
||||
len += 1
|
||||
@@ -385,11 +385,3 @@ extension String.Index {
|
||||
return String.Index(encodedOffset: offset + 1)
|
||||
}
|
||||
}
|
||||
|
||||
extension UnsafeBufferPointer where Element == UInt8 {
|
||||
@usableFromInline @inline(__always)
|
||||
internal func _utf8ScalarLength(at index: Int) -> Int {
|
||||
let x: UInt8 = self[index]
|
||||
return Swift._utf8ScalarLength(x)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user