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

Function EncodeVarint

encoder.go:406–415  ·  view source on GitHub ↗

EncodeVarint encodes v into dest using the Protobuf base-128 varint format and returns the number of bytes written

(dest []byte, v uint64)

Source from the content-addressed store, hash-verified

404// EncodeVarint encodes v into dest using the Protobuf base-128 varint format and returns the number
405// of bytes written
406func EncodeVarint(dest []byte, v uint64) int {
407 n := 0
408 for v >= 1<<7 {
409 dest[n] = uint8(v&0x7f | 0x80)
410 v >>= 7
411 n++
412 }
413 dest[n] = uint8(v)
414 return n + 1
415}
416
417// EncodeFixed32 encodes v into dest using the Protobuf fixed 32-bit encoding, which is just the 4 bytes
418// of the value in little-endian format, and returns the number of bytes written

Callers 15

EncodeBytesMethod · 0.85
EncodeUInt32Method · 0.85
EncodeUInt64Method · 0.85
EncodeInt32Method · 0.85
EncodeInt64Method · 0.85
EncodePackedBoolMethod · 0.85
EncodePackedInt32Method · 0.85
EncodePackedInt64Method · 0.85
EncodePackedUInt32Method · 0.85
EncodePackedUInt64Method · 0.85
EncodePackedSInt32Method · 0.85
EncodePackedSInt64Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected