File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -533,14 +533,18 @@ extension String.UTF16View {
533
533
//Find the number of continuations (0b10xxxxxx)
534
534
let sValue = Builtin . loadRaw ( readPtr. _rawValue) as S
535
535
let continuations = S . zero. replacing ( with: S . one, where: sValue .< - 65 + 1 )
536
- let continuationCount = Int ( continuations. wrappedSum ( ) )
537
536
538
537
//Find the number of 4 byte code points (0b11110xxx)
539
538
let uValue = Builtin . loadRaw ( readPtr. _rawValue) as U
540
- let fourBytes = U . zero. replacing ( with: U . one, where: uValue .>= 0b11110000 )
541
- let fourByteCount = Int ( fourBytes. wrappedSum ( ) )
542
-
543
- utf16Count &+= ( U . scalarCount - continuationCount) + fourByteCount
539
+ let fourBytes = S . zero. replacing (
540
+ with: S . one,
541
+ where: unsafeBitCast (
542
+ uValue .>= 0b11110000 ,
543
+ to: SIMDMask< S . MaskStorage> . self
544
+ )
545
+ )
546
+
547
+ utf16Count &+= U . scalarCount + Int( ( fourBytes &- continuations) . wrappedSum ( ) )
544
548
545
549
readPtr += MemoryLayout< U> . stride
546
550
}
You can’t perform that action at this time.
0 commit comments