MCPcopy Create free account
hub / github.com/SoftbearStudios/bitcode / read

Method read

src/pack_ints.rs:40–54  ·  view source on GitHub ↗
(input: &mut &[u8])

Source from the content-addressed store, hash-verified

38 }
39
40 fn read<T: SizedUInt>(input: &mut &[u8]) -> Result<(Self, bool)> {
41 let v = consume_byte(input)?;
42 let p_u8 = crate::nightly::div_ceil_u8(v, 2) + Self::new(T::MAX) as u8;
43 let offset_by_min = v & 1 != 0;
44 let p = match p_u8 {
45 0 => Self::_128,
46 1 => Self::_64,
47 2 => Self::_32,
48 3 => Self::_16,
49 4 => Self::_8,
50 _ => return invalid_packing(),
51 };
52 debug_assert_eq!(p as u8, p_u8);
53 Ok((p, offset_by_min))
54 }
55}
56
57fn usize_too_big() -> Error {

Callers

nothing calls this directly

Calls 2

consume_byteFunction · 0.85
invalid_packingFunction · 0.85

Tested by

no test coverage detected