Change comparsion for checking if number is negative to include 128

Reason: The last byte in Little Endian representation of negative
integers start at 128 (Ox80) till 255 (OxFF). The comparison before
the fix didn't check for 128 which made is_negative variable as false.
This commit is contained in:
dfireBird 2023-06-22 12:43:29 +05:30
parent 85493dfdb0
commit b8017928af
No known key found for this signature in database
GPG key ID: 26D522CA5FC2B93D

View file

@ -2122,7 +2122,7 @@ impl Evaluator<'_> {
}
pub fn pad16(x: &[u8], is_signed: bool) -> [u8; 16] {
let is_negative = is_signed && x.last().unwrap_or(&0) > &128;
let is_negative = is_signed && x.last().unwrap_or(&0) > &127;
let fill_with = if is_negative { 255 } else { 0 };
x.iter()
.copied()