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

Method decode_float

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

Source from the content-addressed store, hash-verified

300 }
301 #[inline(always)]
302 pub fn decode_float(&mut self, prop: &Prop) -> Option<f32> {
303 let val = self.decode_special_float(prop)?;
304
305 if val != 0.0 {
306 Some(val as f32)
307 } else {
308 let mut interp = 1;
309 if prop.num_bits != -1 {
310 interp = self.read_nbits(prop.num_bits as u32)?;
311 }
312 let mut val = (interp / (1 << (prop.num_bits - 1))) as f32;
313 val = prop.low_value + (prop.high_value - prop.low_value) * (val as f32);
314 Some(val)
315 }
316 }
317 #[inline(always)]
318 pub fn decode_int(&mut self, prop: &Prop) -> Option<u32> {
319 let flags = prop.flags;

Callers 3

decodeMethod · 0.80
decode_vecMethod · 0.80
decode_vec_xyMethod · 0.80

Calls 2

decode_special_floatMethod · 0.80
read_nbitsMethod · 0.80

Tested by

no test coverage detected