Skip to content

[stdlib] Don’t do full integer conversions in _roundUp #60917

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

Merged
merged 1 commit into from
Sep 4, 2022

Conversation

lorentey
Copy link
Member

@lorentey lorentey commented Sep 1, 2022

This code is exercised on pretty much every access to ManagedBuffer — let’s keep it as simple as possible.

The overflow case is not expected to ever occur here; this code is used to align offsets within objects, it isn’t expected to get inputs anywhere near Int.max.

This code is exercised on pretty much every access to ManagedBuffer — let’s keep it as simple as possible.

The overflow case is not expected to ever occur here; this code is used to align offsets within objects, it isn’t expected to get inputs anywhere near Int.max.
@lorentey
Copy link
Member Author

lorentey commented Sep 1, 2022

@swift-ci test

@lorentey
Copy link
Member Author

lorentey commented Sep 1, 2022

I'm not sure if this deserves a dedicated test case -- we could look for "Not enough bits to represent the passed value" in the sil, but that might be a bit fragile

Copy link
Contributor

@Catfish-Man Catfish-Man left a comment

Choose a reason for hiding this comment

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

LGTM

@Catfish-Man
Copy link
Contributor

@swift-ci please benchmark

@lorentey lorentey merged commit 486dc27 into swiftlang:main Sep 4, 2022
@lorentey lorentey deleted the no-conversions-please branch September 4, 2022 23:45
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.

2 participants