@@ -45,14 +45,6 @@ public let StringSplitting = [
45
45
setUpFunction: setup) ,
46
46
]
47
47
48
- private var c = 0
49
-
50
- @inline ( never)
51
- public func blackHole( _ x: String ) {
52
- c += x. isEmpty ? 1 : 0
53
- }
54
-
55
-
56
48
57
49
// Line-sink benchmarks: Implement `lines`-like functionality
58
50
enum View {
@@ -108,9 +100,9 @@ fileprivate func _linesByScalars(
108
100
source scalarSource: ( ) throws -> Unicode . Scalar ? ,
109
101
sink lineSink: ( String ) -> ( )
110
102
) rethrows {
111
- guard #available( macOS 10 . 15 , iOS 13 , tvOS 13 , watchOS 6 , * ) else {
112
- fatalError ( " unavailable " )
113
- }
103
+ guard #available( macOS 10 . 15 , iOS 13 , tvOS 13 , watchOS 6 , * ) else {
104
+ fatalError ( " unavailable " )
105
+ }
114
106
115
107
var buffer : Array < UInt8 > = [ ]
116
108
func yield( ) {
@@ -141,7 +133,7 @@ fileprivate func _linesByScalars(
141
133
}
142
134
}
143
135
144
- // Inline always to try to ignore any closure stuff
136
+
145
137
@inline ( __always)
146
138
fileprivate func _linesByBytes(
147
139
source byteSource: ( ) throws -> UInt8 ? ,
@@ -171,6 +163,7 @@ fileprivate func _linesByBytes(
171
163
guard let next = try byteSource ( ) else { return }
172
164
if next != _LF { buffer. append ( next) }
173
165
case 0x0A ..< 0x0D : yield( )
166
+
174
167
case 0xE2 :
175
168
// Try to read: 80 [A8 | A9].
176
169
// If we can't, then we put the byte in the buffer for error correction
@@ -304,7 +297,7 @@ private let alphaInteriorNewlines: String =
304
297
) def \( Unicode . Scalar ( 0x0B ) ! // VT
305
298
) ghi \( Unicode . Scalar ( 0x0C ) ! // FF
306
299
) jkl \( Unicode . Scalar ( 0x0D ) ! // CR
307
- ) mno \( Unicode . Scalar ( 0x0D ) ! // CR-LF
300
+ ) mno \( Unicode . Scalar ( 0x0D ) !) \( Unicode . Scalar ( 0x0A ) ! // CR-LF
308
301
) pqr \( Unicode . Scalar ( 0x2028 ) ! // LS
309
302
) stu \( Unicode . Scalar ( 0x2029 ) ! // PS
310
303
) vwx
0 commit comments