1
Fork 0

Simplify assert_bits impl

This commit is contained in:
oli 2020-11-01 17:32:51 +00:00
parent dad0036cb4
commit 98b70c9ac0

View file

@ -225,10 +225,9 @@ impl ScalarInt {
#[inline] #[inline]
pub fn assert_bits(self, target_size: Size) -> u128 { pub fn assert_bits(self, target_size: Size) -> u128 {
assert_ne!(target_size.bytes(), 0, "you should never look at the bits of a ZST"); self.to_bits(target_size).unwrap_or_else(|size| {
assert_eq!(target_size.bytes(), u64::from(self.size)); bug!("int of size {}, but is {}", target_size.bytes(), size.bytes())
self.check_data(); })
self.data
} }
#[inline] #[inline]