-
Notifications
You must be signed in to change notification settings - Fork 674
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 uses of mem::transmute
with safe methods
#1983
Conversation
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.
bors r+
Thanks!
1983: Replace uses of `mem::transmute` with safe methods r=rtzoeller a=djkoloski These transmutes are unnecessary and technically incorrect since std doesn't guarantee that the byte order of their network address types matches the expected byte order of libc. Co-authored-by: David Koloski <[email protected]>
Canceled. |
I made that change partly for performance reasons, in order to make it truly zero-cost. But the main motivation was to make ipv4addr_to_libc a |
Is there actually a performance benefit from using As expected, the unsound approach is better under
But that advantage goes away as soon as any optimizations are enabled.
This holds for ARM assembly (
Notably, |
This PR has been replaced by #2061, so I will close it. Sorry about this @djkoloski and thanks for your great work! |
These transmutes are unnecessary and technically incorrect since std doesn't guarantee that the byte order of their network address types matches the expected byte order of libc.