mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-31 21:47:15 +03:00
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:
@@ -2122,7 +2122,7 @@ fn write_to_stderr(&mut self, interval: Interval) -> Result<()> {
|
||||
}
|
||||
|
||||
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()
|
||||
|
||||
Reference in New Issue
Block a user