perf: make signed_integer's is_constant method faster

Signed-off-by: ljedrz <ljedrz@gmail.com>
This commit is contained in:
ljedrz 2020-10-21 12:06:14 +02:00
parent 153202752f
commit afe669babd

View File

@ -82,18 +82,8 @@ macro_rules! int_impl {
}
fn is_constant(&self) -> bool {
let mut constant = true;
// If any bits of self are allocated bits, return false
for bit in &self.bits {
match *bit {
Boolean::Is(ref _bit) => constant = false,
Boolean::Not(ref _bit) => constant = false,
Boolean::Constant(_bit) => {}
}
}
constant
self.bits.iter().all(|bit| matches!(bit, Boolean::Constant(_)))
}
}
};