mirror of
https://codeberg.org/demostf/parser.git
synced 2026-06-05 02:54:10 +02:00
fix some more overflow panics
This commit is contained in:
parent
7cc06bddee
commit
66d568a65f
3 changed files with 3 additions and 4 deletions
|
|
@ -483,7 +483,7 @@ impl SendPropValue {
|
|||
.ok_or(MalformedSendPropDefinitionError::UnsizedFloat)?;
|
||||
let raw: u32 = stream.read_int(bit_count as usize)?;
|
||||
// is this -1 correct?, it is consistent with the js version but seems weird
|
||||
let percentage = (raw as f32) / ((1 << bit_count) as f32 - 1.0);
|
||||
let percentage = (raw as f32) / ((1i32.wrapping_shl(bit_count)) as f32 - 1.0);
|
||||
Ok(low + ((high - low) * percentage))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue