From 4c894b97a0867da7db7238ddf68e11357f9627b7 Mon Sep 17 00:00:00 2001 From: Patrick Pijnappel Date: Sat, 26 Dec 2015 11:13:54 +1100 Subject: [PATCH 1/2] [stdlib] Fix comment Amendment to my own commit. --- stdlib/public/core/IntegerParsing.swift.gyb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/public/core/IntegerParsing.swift.gyb b/stdlib/public/core/IntegerParsing.swift.gyb index 042111b792037..017b5ba56158c 100644 --- a/stdlib/public/core/IntegerParsing.swift.gyb +++ b/stdlib/public/core/IntegerParsing.swift.gyb @@ -97,7 +97,7 @@ internal func _parseAsciiAsIntMax( if utf16.isEmpty { return nil } // Parse (optional) sign. let (digitsUTF16, hasMinus) = _parseOptionalAsciiSign(utf16) - // Parse digits. +1 for because e.g. Int8's range is -128...127. + // Parse digits. +1 for negatives because e.g. Int8's range is -128...127. let absValueMax = UIntMax(bitPattern: maximum) + (hasMinus ? 1 : 0) guard let absValue = _parseUnsignedAsciiAsUIntMax(digitsUTF16, radix, absValueMax) From f181a6eca3f4b84e4a5a7a225ec304856283f505 Mon Sep 17 00:00:00 2001 From: Patrick Pijnappel Date: Sat, 26 Dec 2015 11:18:22 +1100 Subject: [PATCH 2/2] [stdlib] Remove return comments --- stdlib/public/core/IntegerParsing.swift.gyb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stdlib/public/core/IntegerParsing.swift.gyb b/stdlib/public/core/IntegerParsing.swift.gyb index 017b5ba56158c..d592104fb64ae 100644 --- a/stdlib/public/core/IntegerParsing.swift.gyb +++ b/stdlib/public/core/IntegerParsing.swift.gyb @@ -80,7 +80,7 @@ internal func _parseAsciiAsUIntMax( else { return nil } // Disallow < 0. if hasMinus && result != 0 { return nil } - // Return. + return result } @@ -102,7 +102,7 @@ internal func _parseAsciiAsIntMax( guard let absValue = _parseUnsignedAsciiAsUIntMax(digitsUTF16, radix, absValueMax) else { return nil } - // Return signed result. + // Convert to signed. return IntMax(bitPattern: hasMinus ? 0 &- absValue : absValue) }