[stdlib] change String’s SIMD bits to load using loadUnaligned

This commit is contained in:
Guillaume Lessard
2022-07-12 15:43:11 -06:00
parent 8bb22f88fc
commit 1b78a1f356

View File

@@ -597,11 +597,11 @@ extension String.UTF16View {
while readPtr + MemoryLayout<U>.stride < endPtr {
//Find the number of continuations (0b10xxxxxx)
let sValue = Builtin.loadRaw(readPtr._rawValue) as S
let sValue = readPtr.loadUnaligned(as: S.self)
let continuations = S.zero.replacing(with: S.one, where: sValue .< -65 + 1)
//Find the number of 4 byte code points (0b11110xxx)
let uValue = Builtin.loadRaw(readPtr._rawValue) as U
let uValue = readPtr.loadUnaligned(as: U.self)
let fourBytes = S.zero.replacing(
with: S.one,
where: unsafeBitCast(