-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use a counter instead of array in lengthOfInt #1608
Conversation
Foundation/ByteCountFormatter.swift
Outdated
@@ -354,14 +354,13 @@ open class ByteCountFormatter : Formatter { | |||
// A helper method to return the length of an int | |||
private func lengthOfInt(number: Int) -> Int { | |||
var num = abs(number) | |||
var length: [Int] = [] | |||
var length = 0 | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see this code is only used to test for length of == 3 or > 3 but maybe length should be at least 1 for a value of 0?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is true, should I fix it in same PR or open a new one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this one is small enough that we can put that fix here as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
@swift-ci please test |
14bc497
to
cde89c3
Compare
cde89c3
to
688a00a
Compare
@swift-ci test and merge |
1 similar comment
@swift-ci test and merge |
No description provided.