mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[SE-0163] Migrate from deprecated Unicode APIs (part 3) (#33175)
This commit is contained in:
@@ -172,20 +172,7 @@ public struct StaticString {
|
||||
return body(UnsafeBufferPointer(
|
||||
start: utf8Start, count: utf8CodeUnitCount))
|
||||
} else {
|
||||
var buffer: UInt64 = 0
|
||||
var i = 0
|
||||
let sink: (UInt8) -> Void = {
|
||||
#if _endian(little)
|
||||
buffer = buffer | (UInt64($0) << (UInt64(i) * 8))
|
||||
#else
|
||||
buffer = buffer | (UInt64($0) << (UInt64(7-i) * 8))
|
||||
#endif
|
||||
i += 1
|
||||
}
|
||||
UTF8.encode(unicodeScalar, into: sink)
|
||||
return body(UnsafeBufferPointer(
|
||||
start: UnsafePointer(Builtin.addressof(&buffer)),
|
||||
count: i))
|
||||
return unicodeScalar.withUTF8CodeUnits { body($0) }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user