(dst []byte, u64 uint64)
| 31 | } |
| 32 | |
| 33 | func AppendCountedUvarint(dst []byte, u64 uint64) []byte { |
| 34 | for u64 != 0 { |
| 35 | dst = append(dst, byte(u64)) |
| 36 | u64 >>= 8 |
| 37 | } |
| 38 | if dst == nil { |
| 39 | // Input was a zero. Since zero was "appended" but encoded |
| 40 | // as nothing, return an empty slice so we don't turn an |
| 41 | // append zero into an append int(null). |
| 42 | dst = []byte{} |
| 43 | } |
| 44 | return dst |
| 45 | } |
| 46 | |
| 47 | func DecodeCountedVarint(b []byte) int64 { |
| 48 | u64 := DecodeCountedUvarint(b) |
no outgoing calls
no test coverage detected