DecodeNonsortingUvarint decodes a value encoded by EncodeNonsortingUvarint. It returns the length of the encoded varint and value.
(buf []byte)
| 2511 | // DecodeNonsortingUvarint decodes a value encoded by EncodeNonsortingUvarint. It |
| 2512 | // returns the length of the encoded varint and value. |
| 2513 | func DecodeNonsortingUvarint(buf []byte) (remaining []byte, length int, value uint64, err error) { |
| 2514 | // TODO(dan): Handle overflow. |
| 2515 | for i, b := range buf { |
| 2516 | value += uint64(b & 0x7f) |
| 2517 | if b < 0x80 { |
| 2518 | return buf[i+1:], i + 1, value, nil |
| 2519 | } |
| 2520 | value <<= 7 |
| 2521 | } |
| 2522 | return buf, 0, 0, nil |
| 2523 | } |
| 2524 | |
| 2525 | // DecodeNonsortingStdlibUvarint decodes a value encoded with binary.PutUvarint. It |
| 2526 | // returns the length of the encoded varint and value. |
no outgoing calls
no test coverage detected
searching dependent graphs…