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

Support bitfield allocation units larger than 64 bits #1158

Merged
merged 1 commit into from
Nov 23, 2017
Merged

Support bitfield allocation units larger than 64 bits #1158

merged 1 commit into from
Nov 23, 2017

Commits on Nov 21, 2017

  1. Support bitfield allocation units larger than 64 bits

    Individual bitfields are still limited to at most 64 bits, but this
    restriction can be weakened when Rust supports u128.
    
    This implements issue #816.
    
    Usage notes:
    
    * Since common code is added to each generated binding, a program which uses
      more than one binding may need to work around the duplication by including
      each binding in its own module.
    * The values created by bitfield allocation unit constructors can be assigned
      directly to the corresponding struct fields with no need for transmutation.
    
    Implementation notes:
    
    __BindgenBitfieldUnit represents a bitfield allocation unit using a Storage
    type accessible as a slice of u8. The alignment of the unit is inherited from
    an Align type by virtue of the field:
    
    align: [Align; 0],
    
    The position of this field in the struct is irrelevant.
    
    The alignment of the Storage type is intended to be no larger than the
    alignment of the Align type, which will be true if the Storage type is, for
    example, an array of u8.
    
    Although the double underscore (__) prefix is reserved for implementations of
    C++, there are precedents for this convention elsewhere in bindgen and so the
    convention is adopted here too.
    
    Acknowledgement:
    
    Thanks to @fitzgen for an initial implementation of __BindgenBitfieldUnit and
    code to integrate it into bindgen.
    fitzgen authored and glyn committed Nov 21, 2017
    Configuration menu
    Copy the full SHA
    f0e0531 View commit details
    Browse the repository at this point in the history