MCPcopy Create free account
hub / github.com/ZeppelinMC/Zeppelin / AppendVarLong

Function AppendVarLong

protocol/net/io/encoding/encoding.go:131–145  ·  view source on GitHub ↗
(data []byte, value int64)

Source from the content-addressed store, hash-verified

129}
130
131func AppendVarLong(data []byte, value int64) []byte {
132 var (
133 continueBit int64 = 128
134 segmentBits int64 = 127
135 )
136 for {
137 if (value & ^segmentBits) == 0 {
138 return append(data, byte(value))
139 }
140
141 data = append(data, byte((value&segmentBits)|continueBit))
142
143 value >>= 7
144 }
145}
146
147func AppendString(data []byte, str string) []byte {
148 data = AppendVarInt(data, int32(len(str)))

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected