Add an assertion in const eval
This commit is contained in:
parent
e4a854e495
commit
7ce867f552
1 changed files with 8 additions and 2 deletions
|
@ -488,8 +488,14 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
|
|||
}
|
||||
sym::ctlz | sym::ctlz_nonzero => u128::from(bits.leading_zeros()) - extra,
|
||||
sym::cttz | sym::cttz_nonzero => u128::from((bits << extra).trailing_zeros()) - extra,
|
||||
sym::bswap => (bits << extra).swap_bytes(),
|
||||
sym::bitreverse => (bits << extra).reverse_bits(),
|
||||
sym::bswap => {
|
||||
assert_eq!(layout, ret_layout);
|
||||
(bits << extra).swap_bytes()
|
||||
}
|
||||
sym::bitreverse => {
|
||||
assert_eq!(layout, ret_layout);
|
||||
(bits << extra).reverse_bits()
|
||||
}
|
||||
_ => bug!("not a numeric intrinsic: {}", name),
|
||||
};
|
||||
Ok(Scalar::from_uint(bits_out, ret_layout.size))
|
||||
|
|
Loading…
Add table
Reference in a new issue