DecodeUint32Ascending decodes a uint32 from the input buffer, treating the input as a big-endian 4 byte uint32 representation. The remainder of the input buffer and the decoded uint32 are returned.
(b []byte)
| 153 | // the input as a big-endian 4 byte uint32 representation. The remainder |
| 154 | // of the input buffer and the decoded uint32 are returned. |
| 155 | func DecodeUint32Ascending(b []byte) ([]byte, uint32, error) { |
| 156 | if len(b) < 4 { |
| 157 | return nil, 0, errors.Errorf("insufficient bytes to decode uint32 int value") |
| 158 | } |
| 159 | v := binary.BigEndian.Uint32(b) |
| 160 | return b[4:], v, nil |
| 161 | } |
| 162 | |
| 163 | // EncodeUint64Ascending encodes the uint64 value using a big-endian 8 byte |
| 164 | // representation. The bytes are appended to the supplied buffer and |
no test coverage detected