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

Fix bitfields on big-endian machines. #1342

Merged
merged 2 commits into from
Jul 1, 2018
Merged

Conversation

psumbera
Copy link
Contributor

Fixes #1340

@@ -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")]
Copy link
Contributor

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.

Copy link
Contributor

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.

Copy link
Contributor

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.

@emilio
Copy link
Contributor

emilio commented Jul 1, 2018

Sorry for the lag here, this looks fine but the tests need to be updated. I'll get to it ASAP.

Copy link
Contributor

@emilio emilio left a comment

Choose a reason for hiding this comment

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

Looks fine, thanks.

@emilio
Copy link
Contributor

emilio commented Jul 1, 2018

@bors-servo r+

@bors-servo
Copy link

📌 Commit a642894 has been approved by emilio

@bors-servo
Copy link

⌛ Testing commit a642894 with merge c3955dd...

bors-servo pushed a commit that referenced this pull request Jul 1, 2018
Fix bitfields on big-endian machines.

Fixes #1340
@bors-servo
Copy link

☀️ Test successful - status-travis
Approved by: emilio
Pushing c3955dd to master...

@bors-servo bors-servo merged commit a642894 into rust-lang:master Jul 1, 2018
@bors-servo bors-servo mentioned this pull request Jul 1, 2018
emilio added a commit to emilio/rust-bindgen that referenced this pull request Jul 1, 2018
bors-servo pushed a commit that referenced this pull request Jul 1, 2018
 codegen: Allow unused_mut to prevent warnings on little-endian machines.

And fixup whitespace.

This is a followup #1342.
emilio added a commit to emilio/rust-bindgen that referenced this pull request Jul 1, 2018
bors-servo pushed a commit that referenced this pull request Jul 1, 2018
 codegen: Allow unused_mut to prevent warnings on little-endian machines.

And fixup whitespace.

This is a followup #1342.
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.

5 participants