DecodeNonsortingUvarint decodes a value encoded by EncodeNonsortingUvarint. It returns the length of the encoded varint and value.
(buf []byte)
| 1755 | // DecodeNonsortingUvarint decodes a value encoded by EncodeNonsortingUvarint. It |
| 1756 | // returns the length of the encoded varint and value. |
| 1757 | func DecodeNonsortingUvarint(buf []byte) (remaining []byte, length int, value uint64, err error) { |
| 1758 | // TODO(dan): Handle overflow. |
| 1759 | for i, b := range buf { |
| 1760 | value += uint64(b & 0x7f) |
| 1761 | if b < 0x80 { |
| 1762 | return buf[i+1:], i + 1, value, nil |
| 1763 | } |
| 1764 | value <<= 7 |
| 1765 | } |
| 1766 | return buf, 0, 0, nil |
| 1767 | } |
| 1768 | |
| 1769 | // DecodeNonsortingStdlibUvarint decodes a value encoded with binary.PutUvarint. It |
| 1770 | // returns the length of the encoded varint and value. |
no outgoing calls
no test coverage detected
searching dependent graphs…