Skip to content

Commit d3f0de8

Browse files
[SE-0163] Migrate from deprecated Unicode APIs (part 3) (#33175)
1 parent 69abfc1 commit d3f0de8

File tree

2 files changed

+2
-15
lines changed

2 files changed

+2
-15
lines changed

stdlib/public/core/StaticString.swift

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -172,20 +172,7 @@ public struct StaticString {
172172
return body(UnsafeBufferPointer(
173173
start: utf8Start, count: utf8CodeUnitCount))
174174
} else {
175-
var buffer: UInt64 = 0
176-
var i = 0
177-
let sink: (UInt8) -> Void = {
178-
#if _endian(little)
179-
buffer = buffer | (UInt64($0) << (UInt64(i) * 8))
180-
#else
181-
buffer = buffer | (UInt64($0) << (UInt64(7-i) * 8))
182-
#endif
183-
i += 1
184-
}
185-
UTF8.encode(unicodeScalar, into: sink)
186-
return body(UnsafeBufferPointer(
187-
start: UnsafePointer(Builtin.addressof(&buffer)),
188-
count: i))
175+
return unicodeScalar.withUTF8CodeUnits { body($0) }
189176
}
190177
}
191178

test/IRGen/objc_super.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,5 +136,5 @@ class GenericRuncer<T> : Gizmo {
136136
}
137137

138138
// CHECK: define internal swiftcc void [[PARTIAL_FORWARDING_THUNK]](%swift.refcounted* swiftself %0) {{.*}} {
139-
// CHECK: @"$ss12StaticStringV14withUTF8BufferyxxSRys5UInt8VGXElFyAEcfU_"
139+
// CHECK: @"$ss12StaticStringV14withUTF8BufferyxxSRys5UInt8VGXElFxAFXEfU_"
140140
// CHECK: }

0 commit comments

Comments
 (0)