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

Rely on external library for reversing bits #1

Open
RandomInsano opened this issue Apr 6, 2018 · 1 comment
Open

Rely on external library for reversing bits #1

RandomInsano opened this issue Apr 6, 2018 · 1 comment

Comments

@RandomInsano
Copy link

I was just perusing the codebase here and thought I'd mention you can use bit_reverse instead of rolling your own. Specifically this guy.

The only benefit here would be to save some space if multiple people are using the same crate / version. Other option is that we request it be included in the HAL's SPI layer because I hit the same problem building a driver for a PlayStation controller where my target doesn't have hardware support for flipping the bits for me.

@peter9477
Copy link

Note that Rust (as of 1.37.0) may have support for intrinsics such as u8::reverse_bits(), at least on supporting micros (not including Cortex-M0 or M33 but including M4, M7 and others). I have not tried actually using those yet but if it can do it with a single RBIT instruction instead of a function and table of 256 bytes, that's a big win.

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

No branches or pull requests

2 participants