DecodeVarint consumes an encoded unsigned varint from the buffer.
()
| 187 | |
| 188 | // DecodeVarint consumes an encoded unsigned varint from the buffer. |
| 189 | func (b *Buffer) DecodeVarint() (uint64, error) { |
| 190 | v, n := protowire.ConsumeVarint(b.buf[b.idx:]) |
| 191 | if n < 0 { |
| 192 | return 0, protowire.ParseError(n) |
| 193 | } |
| 194 | b.idx += n |
| 195 | return uint64(v), nil |
| 196 | } |
| 197 | |
| 198 | // DecodeZigzag32 consumes an encoded 32-bit zig-zag varint from the buffer. |
| 199 | func (b *Buffer) DecodeZigzag32() (uint64, error) { |
no outgoing calls