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 byteswap intrinsics for converting from big/little to host endian #11265

Closed
wants to merge 3 commits into from

Conversation

c-a
Copy link
Contributor

@c-a c-a commented Jan 1, 2014

This patchset adds intrinsics similar to the to_[be|le][16|32|64] intrinsics but for going in the reverse direction, e.g. from big/little endian to host endian. Implementation wise they do exactly the same as the corresponding to_* functions but I think it anyway make sense to have them since using the to_* functions in the reverse direction is not entirely intuitive.

The first patch adds the intrinsics and the two following changes instances of bswap* to use the [to|from]_* intrinsics instead.

c-a added 3 commits January 1, 2014 22:27
These are similar to the ntoh[s|l] functions in C and have the style of
from_[be|le][16|32|64].

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Also use the fast version of vuint_at() on all architectures since it now
works on both big and little endian architectures.
@alexcrichton
Copy link
Member

I like having these (as you can see from the code in libnative). I'm not convinced these should go inside unstable::intrinsics, but all of the to_XX functions are in there, so for now I think it's ok.

If we find a better place for these functions, they can all be moved at once.

bors added a commit that referenced this pull request Jan 2, 2014

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
This patchset adds intrinsics similar to the to_[be|le][16|32|64] intrinsics but for going in the reverse direction, e.g. from big/little endian to host endian. Implementation wise they do exactly the same as the corresponding to_* functions but I think it anyway make sense to have them since using the to_* functions in the reverse direction is not entirely intuitive.

The first patch adds the intrinsics and the two following changes instances of bswap* to use the [to|from]_* intrinsics instead.
@bors bors closed this Jan 2, 2014
flip1995 pushed a commit to flip1995/rust that referenced this pull request Oct 6, 2023
…es, r=llogiq

Don't escape unicode escape braces in `print_literal`

Fixes rust-lang#11264

changelog: none
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.

None yet

3 participants