macro_rules! decode_uint_arr {
($func:ident, $num_ty:ty, $bits:literal) => { ... };
}
Expand description
Builds custom unsigned integer decode functions.
The macro’s 3 parameters are:
- The name of the function.
- The type to return.
- The number of encoded BITS to decode.
leb128fmt::decode_uint_arr!(decode_u33, u64, 33);
let input = [0xFF, 0xFF, 0xFF, 0xFF, 0x1F];
let result = decode_u33(input);
assert_eq!(Some((8589934591, 5)), result);