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

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 11 13:15:42 PST 2016

ruiu added inline comments.

Comment at: docs/PDB/DbiStream.rst:87
+  uint16_t MajorVersion : 7;
+  uint16_t NewVersionFormat : 1;
zturner wrote:
> 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.
Ah, right. But I found it a bit confusing (as I was confused) to use both uint16_t and ulittle16_t to mean little endian 16-bit integer. Maybe you might want to say at the beginning of the document that all values are in little endian and use uint{16,32}_t?


More information about the llvm-commits mailing list