mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[NFC][In Both Senses] Use _NormData type instead of performing a lookup directly
This commit is contained in:
@@ -27,17 +27,8 @@ extension Unicode.Scalar {
|
||||
internal var _isNFCStarter: Bool {
|
||||
// Fast path: All scalars up to U+300 are NFC_QC and have boundaries
|
||||
// before them.
|
||||
if value < 0x300 {
|
||||
return true
|
||||
}
|
||||
|
||||
// Any scalar who has CCC of 0 has a normalization boundary before it AND
|
||||
// any scalar who is also NFC_QC is considered an NFC starter.
|
||||
let normData = _swift_stdlib_getNormData(value)
|
||||
let ccc = normData >> 3
|
||||
let isNFCQC = normData & 0x6 == 0
|
||||
|
||||
return ccc == 0 && isNFCQC
|
||||
let normData = Unicode._NormData(self, fastUpperbound: 0x300)
|
||||
return normData.ccc == 0 && normData.isNFCQC
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user