Skip to content

Commit 17c30f1

Browse files
authored
Merge pull request swiftlang#69194 from karwa/patch-17
[NFC][In Both Senses] Use _NormData type instead of performing a lookup directly
2 parents d147898 + d66e06a commit 17c30f1

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

stdlib/public/core/StringNormalization.swift

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13-
import SwiftShims
14-
1513
extension Unicode.Scalar {
1614
// Normalization boundary - a place in a string where everything left of the
1715
// boundary can be normalized independently from everything right of the
@@ -27,17 +25,8 @@ extension Unicode.Scalar {
2725
internal var _isNFCStarter: Bool {
2826
// Fast path: All scalars up to U+300 are NFC_QC and have boundaries
2927
// 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
28+
let normData = Unicode._NormData(self, fastUpperbound: 0x300)
29+
return normData.ccc == 0 && normData.isNFCQC
4130
}
4231
}
4332

0 commit comments

Comments
 (0)