diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2017-11-23 04:31:10 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-23 04:31:10 -0600 |
commit | 7c3584d7bc328a01ae5352e191f1fd41bb7fb1a9 (patch) | |
tree | ace279bfdbd625d446074c01b958d7b4d44c729a /src/codegen/impl_debug.rs | |
parent | e3e6c730393f97daae93c2394d4af7bc9a5183b4 (diff) | |
parent | f0e05310b43e88e541ed011d20994c02fdcc1a3a (diff) |
Auto merge of #1158 - glyn:large-bitfield-units, r=emilio
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.
It is assumed that the alignment of the `Storage` type is no larger than the
alignment of the `Align` type, which will be true if the `Storage` type is, for
example, an array of `u8`. This assumption is checked in a debug assertion.
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.
r? @emilio
Diffstat (limited to 'src/codegen/impl_debug.rs')
0 files changed, 0 insertions, 0 deletions