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

Add native-endian variants for all get_x and put_y functions in Buf and BufMut #576

Merged
merged 1 commit into from Nov 14, 2022

Conversation

Phantomical
Copy link
Contributor

@Phantomical Phantomical commented Nov 9, 2022

This PR introduces native-endian variants of all the get_x functions in Buf and put_y functions in BufMut. It is pretty much a straightforward copy-paste-and-tweak for each method. There are a lot of methods though, so this PR ended up being rather big.

My use case for these is that I am trying to use bytes to parse records as generated by perf_event_open. The fields in these use the native endianness of the host so using any of the existing methods on Buf would be wrong.

I've gone over this PR several times and I think that I have caught all the copy-paste errors but there may still be some that I missed.

Fixes #549.

@Phantomical Phantomical changed the title Implement native-endian variants for all get_x and put_y functions in Buf and BufMut Add native-endian variants for all get_x and put_y functions in Buf and BufMut Nov 9, 2022
Copy link
Contributor

@Darksonn Darksonn left a comment

Choose a reason for hiding this comment

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

LGTM.

@Phantomical
Copy link
Contributor Author

@Darksonn what is needed to get this merged? The loom test failure is unrelated (and seems to be due to that workflow using an out-of-date toolchain).

@Darksonn
Copy link
Contributor

Once I get around to fixing the loom test, I'll merge this. If you want, you're also welcome to submit a PR that fixes the loom test.

@Phantomical
Copy link
Contributor Author

I've gone and submitted #577. This PR should be good to go whenever you have time :)

@Darksonn Darksonn merged commit 8a8c41f into tokio-rs:master Nov 14, 2022
@Darksonn
Copy link
Contributor

Thanks!

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.

Provide put_ne and get_ne implementations for native endianness
2 participants