Skip to content

Commit 4faa43a

Browse files
[stdlib] Adjust formatting to fit 80 colums
1 parent e6b08b9 commit 4faa43a

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

stdlib/public/core/IntegerParsing.swift.gyb

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ internal func _parseAsciiAsUIntMax(
7676
// Parse (optional) sign
7777
let (digitsUTF16, hasMinus) = _parseOptionalAsciiSign(utf16)
7878
// Parse digits
79-
guard let result = _parseUnsignedAsciiAsUIntMax(digitsUTF16, radix, maximum) else { return nil }
79+
guard let result = _parseUnsignedAsciiAsUIntMax(digitsUTF16, radix, maximum)
80+
else { return nil }
8081
// Disallow < 0
8182
if hasMinus && result != 0 { return nil }
8283
// Return
@@ -96,9 +97,11 @@ internal func _parseAsciiAsIntMax(
9697
if utf16.isEmpty { return nil }
9798
// Parse (optional) sign
9899
let (digitsUTF16, hasMinus) = _parseOptionalAsciiSign(utf16)
99-
// Parse digits
100-
let absValueMax = UIntMax(bitPattern: maximum) + (hasMinus ? 1 : 0) // E.g. Int8's range is -128...127
101-
guard let absValue = _parseUnsignedAsciiAsUIntMax(digitsUTF16, radix, absValueMax) else { return nil }
100+
// Parse digits. +1 for negatives because e.g. Int8's range is -128...127.
101+
let absValueMax = UIntMax(bitPattern: maximum) + (hasMinus ? 1 : 0)
102+
guard let absValue =
103+
_parseUnsignedAsciiAsUIntMax(digitsUTF16, radix, absValueMax)
104+
else { return nil }
102105
// Return signed result
103106
return IntMax(bitPattern: hasMinus ? 0 &- absValue : absValue)
104107
}

0 commit comments

Comments
 (0)