From 21f6c529363ba279ed5062dc8b986cde2c558586 Mon Sep 17 00:00:00 2001 From: Minseong Jang Date: Fri, 1 Nov 2024 17:39:10 +0900 Subject: [PATCH] Fix ICE from constant evaluation --- hazardflow-designs/src/std/value/sint.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/hazardflow-designs/src/std/value/sint.rs b/hazardflow-designs/src/std/value/sint.rs index cca1f16..ed6f97d 100644 --- a/hazardflow-designs/src/std/value/sint.rs +++ b/hazardflow-designs/src/std/value/sint.rs @@ -12,13 +12,11 @@ impl S { /// It panics when `M < N`. #[allow(clippy::identity_op)] pub fn sext(self) -> S - where - [(); (M - N) * 1]:, - [(); N + (M - N)]:, - { + where [(); N + M]: { if M >= N { - let msb_arr: Array = self.0.clip_const::<1>(N - 1).repeat::<{ M - N }>().concat().resize(); - S(self.0.append(msb_arr).resize::()) + let msb = self.0[N - 1]; + let inner = self.0.append(msb.repeat::()); + S::from(inner.resize::()) } else { panic!("M should be larger than N") }