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

Replace calls to StaticArray(UInt8, 1)#unsafe_as(UInt8) #14685

Conversation

straight-shoota
Copy link
Member

@straight-shoota straight-shoota commented Jun 10, 2024

It's unnecessary to use unsafe_as to retrieve the value of a single-item StaticArray.
However, the entire StaticArray is unnecessary because we just need a slice pointing to the location of the value.
The resulting machinecode should be identical in all three variants.

@straight-shoota straight-shoota added this to the 1.13.0 milestone Jun 11, 2024
@straight-shoota straight-shoota merged commit c141700 into crystal-lang:master Jun 12, 2024
61 checks passed
@straight-shoota straight-shoota deleted the refactor/unsafe_as-static_array branch June 12, 2024 13:14
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants