11
11
//===----------------------------------------------------------------------===//
12
12
13
13
@_alwaysEmitIntoClient
14
- internal func _parseDigitsInASCII < Result: FixedWidthInteger > (
15
- _ codeUnits: UnsafeBufferPointer < UInt8 > , radix: Int , isNegative: Bool
14
+ internal func _parseIntegerDigits < Result: FixedWidthInteger > (
15
+ ascii codeUnits: UnsafeBufferPointer < UInt8 > , radix: Int , isNegative: Bool
16
16
) -> Result ? {
17
17
_internalInvariant ( radix >= 2 && radix <= 36 )
18
18
guard _fastPath ( !codeUnits. isEmpty) else { return nil }
@@ -57,8 +57,8 @@ internal func _parseDigitsInASCII<Result: FixedWidthInteger>(
57
57
}
58
58
59
59
@_alwaysEmitIntoClient
60
- internal func _parseASCII < Result: FixedWidthInteger > (
61
- _ codeUnits: UnsafeBufferPointer < UInt8 > , radix: Int
60
+ internal func _parseInteger < Result: FixedWidthInteger > (
61
+ ascii codeUnits: UnsafeBufferPointer < UInt8 > , radix: Int
62
62
) -> Result ? {
63
63
_internalInvariant ( !codeUnits. isEmpty)
64
64
@@ -67,25 +67,25 @@ internal func _parseASCII<Result: FixedWidthInteger>(
67
67
68
68
let first = codeUnits [ 0 ]
69
69
if first == _minus {
70
- return _parseDigitsInASCII (
71
- UnsafeBufferPointer ( rebasing: codeUnits [ 1 ... ] ) ,
70
+ return _parseIntegerDigits (
71
+ ascii : UnsafeBufferPointer ( rebasing: codeUnits [ 1 ... ] ) ,
72
72
radix: radix, isNegative: true )
73
73
}
74
74
if first == _plus {
75
- return _parseDigitsInASCII (
76
- UnsafeBufferPointer ( rebasing: codeUnits [ 1 ... ] ) ,
75
+ return _parseIntegerDigits (
76
+ ascii : UnsafeBufferPointer ( rebasing: codeUnits [ 1 ... ] ) ,
77
77
radix: radix, isNegative: false )
78
78
}
79
- return _parseDigitsInASCII ( codeUnits, radix: radix, isNegative: false )
79
+ return _parseIntegerDigits ( ascii : codeUnits, radix: radix, isNegative: false )
80
80
}
81
81
82
82
@_alwaysEmitIntoClient
83
83
@inline ( never)
84
- internal func _parseASCII < S: StringProtocol , Result: FixedWidthInteger > (
85
- _ text: S , radix: Int
84
+ internal func _parseInteger < S: StringProtocol , Result: FixedWidthInteger > (
85
+ ascii text: S , radix: Int
86
86
) -> Result ? {
87
87
var str = String ( text)
88
- return str. withUTF8 { _parseASCII ( $0, radix: radix) }
88
+ return str. withUTF8 { _parseInteger ( ascii : $0, radix: radix) }
89
89
}
90
90
91
91
extension FixedWidthInteger {
@@ -128,8 +128,8 @@ extension FixedWidthInteger {
128
128
guard _fastPath ( !text. isEmpty) else { return nil }
129
129
let result : Self ? =
130
130
text. utf8. withContiguousStorageIfAvailable {
131
- _parseASCII ( $0, radix: radix)
132
- } ?? _parseASCII ( text, radix: radix)
131
+ _parseInteger ( ascii : $0, radix: radix)
132
+ } ?? _parseInteger ( ascii : text, radix: radix)
133
133
guard let result_ = result else { return nil }
134
134
self = result_
135
135
}
0 commit comments