EncodeVarint encodes v into dest using the Protobuf base-128 varint format and returns the number of bytes written
(dest []byte, v uint64)
| 404 | // EncodeVarint encodes v into dest using the Protobuf base-128 varint format and returns the number |
| 405 | // of bytes written |
| 406 | func 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 |
no outgoing calls
no test coverage detected