Remove From<Block> for [u64; 2].

This commit is contained in:
Brian Smith 2023-10-10 20:41:39 -07:00
parent 8a6d6f4dbe
commit e0eb70d848
2 changed files with 4 additions and 8 deletions

View File

@ -49,13 +49,6 @@ impl From<[u64; 2]> for Block {
} }
} }
impl From<Block> for [u64; 2] {
#[inline]
fn from(Block(components): Block) -> Self {
components.map(Into::into)
}
}
impl BitXorAssign for Block { impl BitXorAssign for Block {
#[inline] #[inline]
fn bitxor_assign(&mut self, a: Self) { fn bitxor_assign(&mut self, a: Self) {

View File

@ -235,7 +235,10 @@ pub(super) fn ghash(xi: &mut Xi, h: super::u128, input: &[[u8; BLOCK_LEN]]) {
#[inline] #[inline]
fn with_swapped_xi(Xi(xi): &mut Xi, f: impl FnOnce(&mut [u64; 2])) { fn with_swapped_xi(Xi(xi): &mut Xi, f: impl FnOnce(&mut [u64; 2])) {
let unswapped: [u64; 2] = (*xi).into(); let unswapped: [u64; 2] = {
let xi: &[[u8; 8]; 2] = xi.as_ref().chunks_fixed();
xi.map(u64::from_be_bytes)
};
let mut swapped: [u64; 2] = [unswapped[1], unswapped[0]]; let mut swapped: [u64; 2] = [unswapped[1], unswapped[0]];
f(&mut swapped); f(&mut swapped);
*xi = Block::from([swapped[1], swapped[0]]) *xi = Block::from([swapped[1], swapped[0]])