-
Notifications
You must be signed in to change notification settings - Fork 698
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
Fix bitfields on big-endian machines. #1342
Conversation
@@ -27,7 +27,12 @@ where | |||
let byte_index = index / 8; | |||
let byte = self.storage.as_ref()[byte_index]; | |||
|
|||
let bit_index = index % 8; | |||
let mut bit_index = index % 8; | |||
#[cfg(target_endian = "big")] |
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.
It probably should use some runtime target information rather than build time config, because people may want to cross-compile.
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.
That's fine though, isn't it? This code is included in the target code.
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.
Oh, this is the code bindgen adds to the generated binding file. That makes sense then.
Sorry for the lag here, this looks fine but the tests need to be updated. I'll get to it ASAP. |
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.
Looks fine, thanks.
@bors-servo r+ |
📌 Commit a642894 has been approved by |
Fix bitfields on big-endian machines. Fixes #1340
☀️ Test successful - status-travis |
…es, and fix formatting issues. Followup to rust-lang#1342
codegen: Allow unused_mut to prevent warnings on little-endian machines. And fixup whitespace. This is a followup #1342.
codegen: Allow unused_mut to prevent warnings on little-endian machines. And fixup whitespace. This is a followup #1342.
Fixes #1340