Skip to content

Commit 7df09b3

Browse files
committed
Use bitfields for clarity in more places
This is a non-functional change to refactor the base of several constants. When doing bitwise arithmetic, it is more clear to use `0b...` constants to visually see the bits. This project does this elsewhere; this change just updates several spots that did not.
1 parent 8653187 commit 7df09b3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,7 @@ impl Operand {
643643
0b1000000 | preg.hw_enc() as u32
644644
}
645645
OperandConstraint::Reuse(which) => {
646-
debug_assert!(which <= 31);
646+
debug_assert!(which <= 0b11111);
647647
0b0100000 | which as u32
648648
}
649649
};
@@ -901,7 +901,7 @@ impl Operand {
901901
/// its allocation must fulfill.
902902
#[inline(always)]
903903
pub fn constraint(self) -> OperandConstraint {
904-
let constraint_field = ((self.bits >> 25) as usize) & 127;
904+
let constraint_field = ((self.bits >> 25) as usize) & 0b1111111;
905905
if constraint_field & 0b1000000 != 0 {
906906
OperandConstraint::FixedReg(PReg::new(constraint_field & 0b0111111, self.class()))
907907
} else if constraint_field & 0b0100000 != 0 {

0 commit comments

Comments
 (0)