MCPcopy Create free account
hub / github.com/CrowdStrike/csproto / EncodePackedBool

Method EncodePackedBool

encoder.go:117–131  ·  view source on GitHub ↗

EncodePackedBool writes a list of booleans to the buffer using packed encoding, preceded by the varint-encoded tag key.

(tag int, vs []bool)

Source from the content-addressed store, hash-verified

115// EncodePackedBool writes a list of booleans to the buffer using packed encoding, preceded by
116// the varint-encoded tag key.
117func (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.

Callers 7

TestEncodePackedBoolFunction · 0.95
MarshalToMethod · 0.80
MarshalToMethod · 0.80
MarshalToMethod · 0.80
MarshalToMethod · 0.80
MarshalToMethod · 0.80
MarshalToMethod · 0.80

Calls 2

EncodeTagFunction · 0.85
EncodeVarintFunction · 0.85

Tested by 1

TestEncodePackedBoolFunction · 0.76