diff options
| author | dfireBird <me@dfirebird.dev> | 2023-06-22 12:43:29 +0530 |
|---|---|---|
| committer | dfireBird <me@dfirebird.dev> | 2023-06-22 12:51:35 +0530 |
| commit | b8017928af94871eba9973ff66086a65bcff3a64 (patch) | |
| tree | 9635ffe44b8750c1462de4c711e803e4b8d63af6 | |
| parent | 85493dfdb045ce78db78c6d50e8015bdb442cc62 (diff) | |
| download | rust-b8017928af94871eba9973ff66086a65bcff3a64.tar.gz rust-b8017928af94871eba9973ff66086a65bcff3a64.zip | |
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.
| -rw-r--r-- | crates/hir-ty/src/mir/eval.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/crates/hir-ty/src/mir/eval.rs b/crates/hir-ty/src/mir/eval.rs index 9acf9d39e56..28b6066c191 100644 --- a/crates/hir-ty/src/mir/eval.rs +++ b/crates/hir-ty/src/mir/eval.rs @@ -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() |
