Skip to content

Commit

Permalink
Fix ICE from constant evaluation
Browse files Browse the repository at this point in the history
  • Loading branch information
minseongg committed Nov 1, 2024
1 parent 7173763 commit 21f6c52
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions hazardflow-designs/src/std/value/sint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,11 @@ impl<const N: usize> S<N> {
/// It panics when `M < N`.
#[allow(clippy::identity_op)]
pub fn sext<const M: usize>(self) -> S<M>
where
[(); (M - N) * 1]:,
[(); N + (M - N)]:,
{
where [(); N + M]: {
if M >= N {
let msb_arr: Array<bool, { M - N }> = self.0.clip_const::<1>(N - 1).repeat::<{ M - N }>().concat().resize();
S(self.0.append(msb_arr).resize::<M>())
let msb = self.0[N - 1];
let inner = self.0.append(msb.repeat::<M>());
S::from(inner.resize::<M>())
} else {
panic!("M should be larger than N")
}
Expand Down

0 comments on commit 21f6c52

Please sign in to comment.