mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Fix off by one
This commit is contained in:
@@ -112,7 +112,9 @@ internal func _utf8Count<U: SIMD>(
|
|||||||
result += _utf8Count(&ptr, base: base, total: count, type: SIMD8<UInt8>.self)
|
result += _utf8Count(&ptr, base: base, total: count, type: SIMD8<UInt8>.self)
|
||||||
result += _utf8Count(&ptr, base: base, total: count, type: SIMD4<UInt8>.self)
|
result += _utf8Count(&ptr, base: base, total: count, type: SIMD4<UInt8>.self)
|
||||||
result += _utf8Count(&ptr, base: base, total: count, type: SIMD2<UInt8>.self)
|
result += _utf8Count(&ptr, base: base, total: count, type: SIMD2<UInt8>.self)
|
||||||
|
if ptr < (base + count) {
|
||||||
result += Int(~ptr.loadUnaligned(as: UInt8.self) >> 7)
|
result += Int(~ptr.loadUnaligned(as: UInt8.self) >> 7)
|
||||||
|
}
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user