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

Method read

src/pack.rs:38–53  ·  view source on GitHub ↗
(input: &mut &[u8])

Source from the content-addressed store, hash-verified

36 }
37
38 fn read(input: &mut &[u8]) -> Result<(Self, bool)> {
39 let v = consume_byte(input)?;
40 let p_u8 = crate::nightly::div_ceil_u8(v, 2);
41 let offset_by_min = v & 1 != 0;
42 let p = match p_u8 {
43 0 => Self::_256,
44 1 => Self::_16,
45 2 => Self::_6,
46 3 => Self::_4,
47 4 => Self::_3,
48 5 => Self::_2,
49 _ => return invalid_packing(),
50 };
51 debug_assert_eq!(p as u8, p_u8);
52 Ok((p, offset_by_min))
53 }
54}
55
56pub(crate) fn invalid_packing<T>() -> Result<T> {

Callers

nothing calls this directly

Calls 2

consume_byteFunction · 0.85
invalid_packingFunction · 0.85

Tested by

no test coverage detected