Skip to content
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

Merged
merged 1 commit into from
Jun 21, 2018

Conversation

otaviolima
Copy link
Contributor

No description provided.

@@ -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

Copy link
Contributor

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?

Copy link
Contributor Author

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?

Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@spevans
Copy link
Contributor

spevans commented Jun 17, 2018

@swift-ci please test

@parkera
Copy link
Contributor

parkera commented Jun 20, 2018

@swift-ci test and merge

1 similar comment
@spevans
Copy link
Contributor

spevans commented Jun 21, 2018

@swift-ci test and merge

@swift-ci swift-ci merged commit c74229f into swiftlang:master Jun 21, 2018
@otaviolima otaviolima deleted the minor-optmization branch June 21, 2018 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants