From a7c5a7ae905287ff2593dcbc830a0117806810c9 Mon Sep 17 00:00:00 2001 From: jirigav Date: Tue, 7 May 2024 23:33:33 +0200 Subject: [PATCH] fix bit-order, change names --- src/bottomup.rs | 1 - src/common.rs | 8 ++++---- src/main.rs | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/bottomup.rs b/src/bottomup.rs index 5ba15be..e1bb574 100644 --- a/src/bottomup.rs +++ b/src/bottomup.rs @@ -186,7 +186,6 @@ fn brute_force(data: &Data, block_size: usize, deg: usize, k: usize) -> Vec usize { } pub(crate) fn bit_value_in_block(bit: usize, block: &[u8]) -> bool { - let (byte_index, offset) = (bit / 8, bit % 8); + let (byte_index, offset) = (bit / 8, 7 - (bit % 8)); ((block[byte_index] >> offset) & 1) == 1 } @@ -125,7 +125,7 @@ pub(crate) fn _multi_eval2(bits: &[usize], data: &Data, t: &mut Duration) -> usi if i == data.data[0].len() { break; } - let mut result = vec![u128::MAX; l as usize]; + let mut result = vec![u128::MAX; l]; for b in bits.iter() { result = result .iter() diff --git a/src/main.rs b/src/main.rs index d56c988..dd8e0a1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -30,8 +30,8 @@ fn run_bottomup(args: Args) { let hist = bottomup( &training_data, args.block, - args.deg, args.k, + args.top, args.max_bits, args.threads, );