From dc0fe08dabd31ca624d374a89fccecdad3e9439f Mon Sep 17 00:00:00 2001 From: GuillaumeDIDIER Date: Thu, 16 Jul 2020 11:47:15 +0200 Subject: [PATCH] Various fixes to the complex addressing module --- cache_utils/src/complex_addressing.rs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/cache_utils/src/complex_addressing.rs b/cache_utils/src/complex_addressing.rs index e011efe..34fce80 100644 --- a/cache_utils/src/complex_addressing.rs +++ b/cache_utils/src/complex_addressing.rs @@ -3,6 +3,8 @@ use crate::complex_addressing::CacheSlicing::{ }; use cpuid::{CPUVendor, MicroArchitecture}; +#[cfg(feature = "no_std")] +use alloc::collections::VecDeque; #[cfg(feature = "no_std")] use hashbrown::HashMap; #[cfg(feature = "no_std")] @@ -12,6 +14,7 @@ use hashbrown::HashSet; use std::collections::HashMap; #[cfg(feature = "use_std")] use std::collections::HashSet; +#[cfg(feature = "use_std")] use std::collections::VecDeque; #[derive(Debug, Copy, Clone)] @@ -165,8 +168,10 @@ impl CacheSlicing { if found_pivot { for j in 0..matrix.len() { if j != i { - matrix[j].0 ^= matrix[i].0; - matrix[j].1 ^= matrix[i].1; + if bit & matrix[j].0 != 0 { + matrix[j].0 ^= matrix[i].0; + matrix[j].1 ^= matrix[i].1; + } } } i += 1; @@ -189,8 +194,8 @@ impl CacheSlicing { pub fn image(&self, mask: usize) -> Option> { match self { - ComplexAddressing(functions) => { - let mut matrix = self.pivot(mask); + ComplexAddressing(_functions) => { + let matrix = self.pivot(mask); let mut result = HashSet::::new(); result.insert(0); @@ -210,7 +215,7 @@ impl CacheSlicing { pub fn kernel_compl_basis(&self, mask: usize) -> Option> { match self { - ComplexAddressing(functions) => { + ComplexAddressing(_functions) => { let matrix = self.pivot(mask); let mut result = HashMap::new(); for (slice, addr) in matrix {