MCPcopy Create free account
hub / github.com/LaihoE/Python-demoparser / decode_array

Method decode_array

src/parsing/read_bits.rs:120–146  ·  view source on GitHub ↗
(&mut self, prop: &Prop)

Source from the content-addressed store, hash-verified

118 }
119
120 pub fn decode_array(&mut self, prop: &Prop) -> Option<Vec<i32>> {
121 // SUS
122 let b = (prop.num_elements as f32).log2().floor() + 1.0;
123 let num_elements = self.read_nbits(b as u32)?;
124
125 let p = prop.arr.as_ref().unwrap();
126 let mut elems = vec![];
127 for _ in 0..num_elements {
128 let pro = Prop {
129 table: "oopsie".to_string(),
130 name: p.to_string(),
131 arr: None,
132 col: 0,
133 data: None,
134 flags: p.flags(),
135 num_elements: p.num_elements(),
136 num_bits: p.num_bits(),
137 low_value: p.high_value(),
138 high_value: p.high_value(),
139 priority: p.priority(),
140 p_type: p.type_(),
141 };
142 let val = self.decode(&pro);
143 elems.push(val);
144 }
145 Some(vec![0, 0, 0])
146 }
147 #[inline(always)]
148 pub fn read_string(&mut self, length: i32) -> Option<String> {
149 let mut s: Vec<u8> = Vec::new();

Callers 1

decodeMethod · 0.80

Calls 8

read_nbitsMethod · 0.80
num_elementsMethod · 0.80
num_bitsMethod · 0.80
high_valueMethod · 0.80
priorityMethod · 0.80
decodeMethod · 0.80
flagsMethod · 0.45
type_Method · 0.45

Tested by

no test coverage detected