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

Function WriteVarInt

protocol/net/io/encoding/encoding.go:55–67  ·  view source on GitHub ↗
(w io.Writer, value int32)

Source from the content-addressed store, hash-verified

53}
54
55func WriteVarInt(w io.Writer, value int32) error {
56 ux := uint32(value)
57 for ux >= 0x80 {
58 if _, err := w.Write([]byte{byte(ux&0x7F) | 0x80}); err != nil {
59 return err
60 }
61
62 ux >>= 7
63 }
64
65 _, err := w.Write([]byte{byte(ux)})
66 return err
67}
68
69func VarInt(data []byte) (int32, []byte, error) {
70 var (

Callers

nothing calls this directly

Calls 1

WriteMethod · 0.45

Tested by

no test coverage detected