diff options
author | zseri <zseri.devel@ytrizja.de> | 2021-12-25T04·23+0100 |
---|---|---|
committer | zseri <zseri.devel@ytrizja.de> | 2021-12-25T05·03+0000 |
commit | 1cc8aa56a44a83fd6d1841089fea8991d792207e (patch) | |
tree | 26b96da601c17c9ce39cca02b8fd315255bba452 /users/zseri/store-ref-scanner/src | |
parent | f4dddea4c375dd0dc472d8879cc4fc506dd77d8c (diff) |
refactor(zseri/store-ref-scanner): get rid of proc_unroll dependency r/3386
Change-Id: I0d4a8b2af814fd2870c3eb4218ee4fbaba1216f5 Reviewed-on: https://cl.tvl.fyi/c/depot/+/4605 Tested-by: BuildkiteCI Reviewed-by: zseri <zseri.devel@ytrizja.de>
Diffstat (limited to 'users/zseri/store-ref-scanner/src')
-rw-r--r-- | users/zseri/store-ref-scanner/src/hbm.rs | 28 |
1 files changed, 16 insertions, 12 deletions
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 } |