EncodePackedBool writes a list of booleans to the buffer using packed encoding, preceded by the varint-encoded tag key.
(tag int, vs []bool)
| 115 | // EncodePackedBool writes a list of booleans to the buffer using packed encoding, preceded by |
| 116 | // the varint-encoded tag key. |
| 117 | func (e *Encoder) EncodePackedBool(tag int, vs []bool) { |
| 118 | if len(vs) == 0 { |
| 119 | return |
| 120 | } |
| 121 | e.offset += EncodeTag(e.p[e.offset:], tag, WireTypeLengthDelimited) |
| 122 | e.offset += EncodeVarint(e.p[e.offset:], uint64(len(vs))) |
| 123 | for _, v := range vs { |
| 124 | if v { |
| 125 | e.p[e.offset] = 1 |
| 126 | } else { |
| 127 | e.p[e.offset] = 0 |
| 128 | } |
| 129 | e.offset++ |
| 130 | } |
| 131 | } |
| 132 | |
| 133 | // EncodePackedInt32 writes a list of 32-bit integers to the buffer using packed encoding, preceded by |
| 134 | // the varint-encoded tag key. |