Skip to content

Commit 178da37

Browse files
committed
[docs] Clarify variable-width integer (VBR) encoding example.
Show that the bit chunks are placed starting at the least significant bit. Select a different number, so the bit chunks have different values and it is more obvious where they are in the encoded result. Differential Revision: https://reviews.llvm.org/D107796
1 parent b34b1c6 commit 178da37

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

llvm/docs/BitCodeFormat.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,11 @@ value (0 through 7) is encoded directly, with the high bit set to zero. Values
104104
larger than N-1 bits emit their bits in a series of N-1 bit chunks, where all
105105
but the last set the high bit.
106106

107-
For example, the value 27 (0x1B) is encoded as 1011 0011 when emitted as a vbr4
108-
value. The first set of four bits indicates the value 3 (011) with a
109-
continuation piece (indicated by a high bit of 1). The next word indicates a
110-
value of 24 (011 << 3) with no continuation. The sum (3+24) yields the value
111-
27.
107+
For example, the value 30 (0x1E) is encoded as 62 (0b0011'1110) when emitted as
108+
a vbr4 value. The first set of four bits starting from the least significant
109+
indicates the value 6 (110) with a continuation piece (indicated by a high bit
110+
of 1). The next set of four bits indicates a value of 24 (011 << 3) with no
111+
continuation. The sum (6+24) yields the value 30.
112112

113113
.. _char6-encoded value:
114114

0 commit comments

Comments
 (0)