From 1cc8aa56a44a83fd6d1841089fea8991d792207e Mon Sep 17 00:00:00 2001 From: zseri Date: Sat, 25 Dec 2021 05:23:13 +0100 Subject: refactor(zseri/store-ref-scanner): get rid of proc_unroll dependency Change-Id: I0d4a8b2af814fd2870c3eb4218ee4fbaba1216f5 Reviewed-on: https://cl.tvl.fyi/c/depot/+/4605 Tested-by: BuildkiteCI Reviewed-by: zseri --- users/zseri/store-ref-scanner/src/hbm.rs | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'users/zseri/store-ref-scanner/src') diff --git a/users/zseri/store-ref-scanner/src/hbm.rs b/users/zseri/store-ref-scanner/src/hbm.rs index c2fd2950d5f1..2520efd8363d 100644 --- a/users/zseri/store-ref-scanner/src/hbm.rs +++ b/users/zseri/store-ref-scanner/src/hbm.rs @@ -15,17 +15,19 @@ impl HalfBytesMask { ]); #[inline] - #[proc_unroll::unroll] pub const fn from_expanded(x: [bool; 128]) -> Self { let mut ret = [0u8; 16]; - for idx in 0..16 { - let mut tmp = 0; + let mut idx = 0; + while idx < 16 { let fin = idx * 8; - macro_rules! bitx { - ($($a:expr),+) => {{ $( if x[fin + $a] { tmp += (1 << $a) as u8; } )+ }} + let mut idx2 = 0; + while idx2 < 8 { + if x[fin + idx2] { + ret[idx] += (1 << idx2) as u8; + } + idx2 += 1; } - bitx!(0, 1, 2, 3, 4, 5, 6, 7); - ret[idx] = tmp; + idx += 1; } Self(ret) } @@ -38,17 +40,19 @@ impl HalfBytesMask { }) } - #[proc_unroll::unroll] pub const fn into_expanded(self) -> [bool; 128] { let Self(ihbm) = self; let mut ret = [false; 128]; - for idx in 0..16 { + let mut idx = 0; + while idx < 16 { let fin = idx * 8; let curi = ihbm[idx]; - macro_rules! bitx { - ($($a:expr),+) => {{ $( ret[fin + $a] = (curi >> $a) & 0b1 != 0; )+ }} + let mut idx2 = 0; + while idx2 < 8 { + ret[fin + idx2] = (curi >> idx2) & 0b1 != 0; + idx2 += 1; } - bitx!(0, 1, 2, 3, 4, 5, 6, 7); + idx += 1; } ret } -- cgit 1.4.1