[PATCH] D26552: [PDB] Add documentation for the PDB DBI Stream.

Zachary Turner via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 11 13:08:09 PST 2016


zturner added inline comments.


================
Comment at: docs/PDB/DbiStream.rst:87
+  uint16_t MajorVersion : 7;
+  uint16_t NewVersionFormat : 1;
+
----------------
ruiu wrote:
> zturner wrote:
> > amccarth wrote:
> > > Bit-field syntax is ambiguous because bit-fields can be allocated left-to-right or right-to-left (implementation defined).  There are also implementation-defined padding and alignment issues.
> > While true, I need a concise way to express this since there are multiple bitfields defined throughout this file and in other files (some of which have not yet been written).  If it was easy to insert images into RestructuredText, I could just draw it out, but I was hoping this could be understood to mean "the first 8 bits are X, the next 7 bits are Y, the final bit is Z", etc.
> Why is this uint16? I wonder if this can be written as
> 
>   uint8_t MinorVersion;
>   uint8_t MajorVersin : 7;
>   uint8_t NewVersionFormat : 1;
No, because the bytes of the file are in little endian.  If you run this code on a big endian machine, then one `ulittle16_t` is not the same as two `uint8_t`'s.   We read it into a `ulittle16_t` and then perform the bitwise operations on that.


https://reviews.llvm.org/D26552





More information about the llvm-commits mailing list