leb128fmt

Function decode_s32

Source
pub const fn decode_s32(input: [u8; 5]) -> Option<(i32, usize)>
Expand description

Decodes an unsigned LEB128 number.

If there is a valid encoded value, returns the decoded value and the index after the last byte read.

If the encoding is incorrect, returns None.

If the size in bits of the returned type is less than the size of the value in bits, returns None. For instance, if 33 bits are being decoded, then the returned type must be at least a u64.