Skip to content

Commit

Permalink
removed unused macro and unnecessary test
Browse files Browse the repository at this point in the history
  • Loading branch information
nstilt1 committed Jun 7, 2024
1 parent 14312d8 commit f984d8e
Showing 1 changed file with 0 additions and 41 deletions.
41 changes: 0 additions & 41 deletions chacha20/src/backends/neon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,19 +115,6 @@ macro_rules! add_assign_vec {
};
}

macro_rules! add_counter {
// macro definition for when V::USES_U32_COUNTER is true
($a:expr, $b:literal, $uses_u32_counter:expr) => {
match $uses_u32_counter {
true => add64!($a, vld1q_u32([$b, 0, 0, 0].as_ptr())),
false => vreinterpretq_u32_u64(vaddq_u64(
vreinterpretq_u64_u32($a),
vld1q_u64([$b, 0].as_ptr()),
)),
}
};
}

#[cfg(feature = "cipher")]
impl<R: Rounds, V: Variant> StreamBackend for Backend<R, V> {
#[inline(always)]
Expand Down Expand Up @@ -343,31 +330,3 @@ unsafe fn cols_to_rows(blocks: &mut [[uint32x4_t; 4]; 4]) {
extract!(block[3], 1);
}
}

#[cfg(test)]
mod tests {
use super::*;

fn reg_to_arr(reg: uint32x4_t) -> [u32; 4] {
unsafe {
let result: [u32; 4] = core::mem::transmute_copy(&reg);
result
}
}

#[test]
fn counter() {
unsafe {
let start: [u32; 4] = [0, 0, 0, 0];
let mut reg = vld1q_u32(start.as_ptr());
let one = vld1q_u32([1, 0, 0, 0].as_ptr());
let result_add64 = add64!(reg, one);
assert_eq!(reg_to_arr(result_add64), [1, 0, 0, 0]);

let max: [u32; 4] = [u32::MAX, 0, 0, 0];
reg = vld1q_u32(max.as_ptr());
let result_add64 = add64!(reg, one);
assert_eq!(reg_to_arr(result_add64), [0, 1, 0, 0]);
}
}
}

0 comments on commit f984d8e

Please sign in to comment.