Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions rust/src/low_level_il/operation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1754,12 +1754,14 @@ where
}
}

let mut mask = -1i64 as u64;

if self.op.size < mem::size_of::<u64>() {
mask <<= self.op.size * 8;
mask = !mask;
}
let mask: u64 = if self.op.size == 0 {
1
Copy link

Copilot AI Oct 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A mask of 1 will only preserve the least significant bit, not the lowest byte. To correctly mask the lowest byte as described in the PR description, the mask should be 0xFF (255) instead of 1.

Suggested change
1
0xFF

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch. That is a bug in the wording of my MR message though and not the actual code.

} else if self.op.size < mem::size_of::<u64>() {
let m = -1i64 << (self.op.size * 8);
!m as u64
} else {
(-1i64) as u64
};

self.op.operands[0] & mask
}
Expand Down
Loading