Skip to content

Commit e9f11d7

Browse files
authored
[NFC][In Both Senses] Use _NormData type instead of performing a lookup directly
1 parent b257a02 commit e9f11d7

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

stdlib/public/core/StringNormalization.swift

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,8 @@ extension Unicode.Scalar {
2727
internal var _isNFCStarter: Bool {
2828
// Fast path: All scalars up to U+300 are NFC_QC and have boundaries
2929
// before them.
30-
if value < 0x300 {
31-
return true
32-
}
33-
34-
// Any scalar who has CCC of 0 has a normalization boundary before it AND
35-
// any scalar who is also NFC_QC is considered an NFC starter.
36-
let normData = _swift_stdlib_getNormData(value)
37-
let ccc = normData >> 3
38-
let isNFCQC = normData & 0x6 == 0
39-
40-
return ccc == 0 && isNFCQC
30+
let normData = Unicode._NormData(self, fastUpperbound: 0x300)
31+
return normData.ccc == 0 && normData.isNFCQC
4132
}
4233
}
4334

0 commit comments

Comments
 (0)