On Sun, Sep 8, 2013 at 3:00 AM, Martin DeMello <[email protected]>wrote:
> I was looking at the bindgen bug for incorrect bitfield handling > > https://github.com/crabtw/rust-bindgen/issues/8 > > but from a quick pass through the rust manual I can't figure out what > the correct behaviour would be. > > What, for example, would the correct bindgen output for the following be: > > struct bit { > int alpha : 12; > int beta : 6; > int gamma : 2; > }; > > You'll have to check what the various C compilers do with bitfields. I imagine they pack the bitfields into the smallest integer type that will contain them all. But, almost everything about bitfields is entirely implementation defined, so it's probably going to be difficult to come up with what to do correctly in any portable way. Once you actually figure out what to generate, though, methods for getting/setting the bitfields would probably be best.
_______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
