We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents cfa0050 + cdd5aa0 commit e6586acCopy full SHA for e6586ac
stdlib/public/core/UnicodeScalar.swift
@@ -474,6 +474,9 @@ extension Unicode.Scalar {
474
) rethrows -> Result {
475
let encodedScalar = UTF8.encode(self)!
476
var (codeUnits, utf8Count) = encodedScalar._bytes
477
+
478
+ // The first code unit is in the least significant byte of codeUnits.
479
+ codeUnits = codeUnits.littleEndian
480
return try Swift.withUnsafePointer(to: &codeUnits) {
481
return try $0.withMemoryRebound(to: UInt8.self, capacity: 4) {
482
return try body(UnsafeBufferPointer(start: $0, count: utf8Count))
0 commit comments