mirror of
https://codeberg.org/demostf/parser.git
synced 2026-06-03 10:14:06 +02:00
Avoid sign-extending unsigned VarInts
This commit is contained in:
parent
b8d747fe51
commit
363821a545
1 changed files with 7 additions and 1 deletions
|
|
@ -654,7 +654,13 @@ impl SendPropValue {
|
||||||
SendPropParseDefinition::NormalVarInt { unsigned, .. } => {
|
SendPropParseDefinition::NormalVarInt { unsigned, .. } => {
|
||||||
read_var_int(stream, !*unsigned)
|
read_var_int(stream, !*unsigned)
|
||||||
.map_err(ParseError::from)
|
.map_err(ParseError::from)
|
||||||
.map(|int| int as i64)
|
.map(|int| {
|
||||||
|
if *unsigned {
|
||||||
|
int as u32 as i64
|
||||||
|
} else {
|
||||||
|
int as i64
|
||||||
|
}
|
||||||
|
})
|
||||||
.map(SendPropValue::from)
|
.map(SendPropValue::from)
|
||||||
}
|
}
|
||||||
SendPropParseDefinition::UnsignedInt { bit_count, .. } => {
|
SendPropParseDefinition::UnsignedInt { bit_count, .. } => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue