-
Notifications
You must be signed in to change notification settings - Fork 60
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
Why does to_bytes() reverse the bits? #31
Comments
This is pretty out of cache for me, but I seem to recall that having the bits in that order makes other operations much more straight-forward. Maybe @huonw remembers? |
I don't remember at all. I suspect it may be because these functions where designed for tests/literals, where writing |
Thanks for the feedback, huonw and soon-to-be Dr. Gankro (as I gather from #20). ;) As mentioned above I was kinda hoping to have a
Really, the last point is because I wanted to load the data with a single So then I did the overundulgent thing (typically excusable for someone trying to learn a language) and reimplemented the data structure as a temporary measure to address all the above. Wooof! |
I agree with Huon. Should we add elaborative functions such as |
I was looking for an efficient way to get a
&[u8]
from theBitVec
to write the bits out to file (when the memory layout is little-endian). I was thinking of adding anas_bytes()
view, but I noticed thatto_bytes()
flips the bits within each byte so that theas_bytes()
I want would be inconsistent with it. Andfrom_bytes()
does the same flip (which made my tests in the code I'm writing fail confusingly).So
The text was updated successfully, but these errors were encountered: