Skip to content

Commit 4e4e00a

Browse files
committed
Delete not needed macros
1 parent b6f255e commit 4e4e00a

File tree

2 files changed

+6
-35
lines changed

2 files changed

+6
-35
lines changed

k12/src/lanes.rs

-21
This file was deleted.

k12/src/lib.rs

+6-14
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ extern crate alloc;
2323

2424
pub use digest;
2525

26-
#[macro_use]
27-
mod lanes;
28-
2926
// TODO(tarcieri): eliminate usage of `Vec`
3027
use alloc::vec::Vec;
3128
use core::{cmp::min, convert::TryInto, mem};
@@ -231,21 +228,16 @@ fn f(input: &[u8], suffix: u8, mut output_len: usize) -> Vec<u8> {
231228
fn keccak(state: &mut [u8; 200]) {
232229
let mut lanes = [0u64; 25];
233230

234-
let mut y;
235-
for x in 0..5 {
236-
FOR5!(y, 5, {
237-
let pos = 8 * (x + y);
238-
lanes[x + y] = u64::from_le_bytes(state[pos..(pos + 8)].try_into().unwrap());
239-
});
231+
for (i, lane) in lanes.iter_mut().enumerate() {
232+
let pos = 8 * i;
233+
*lane = u64::from_le_bytes(state[pos..(pos + 8)].try_into().unwrap());
240234
}
241235

242236
keccak_p(&mut lanes, 12);
243237

244-
for x in 0..5 {
245-
FOR5!(y, 5, {
246-
let i = 8 * (x + y);
247-
state[i..i + 8].copy_from_slice(&lanes[x + y].to_le_bytes());
248-
});
238+
for (i, lane) in lanes.iter().enumerate() {
239+
let pos = 8 * i;
240+
state[pos..(pos + 8)].copy_from_slice(&lane.to_le_bytes());
249241
}
250242
}
251243

0 commit comments

Comments
 (0)