// loadu/storeu support unaligned loads/stores
loadu/storeu support unaligned loads/stores
loadu / storeu support unaligned loads / stores
pub fn apply_keystream(&self, counter: u64, output: &mut [u8]) {
        debug_assert_eq!(output.len(), BUFFER_SIZE);
        for (i, chunk) in output.chunks_exact_mut(BLOCK_SIZE).enumerate() {
            unsafe {
                let (mut v0, mut v1, mut v2) = (self.v0, self.v1, self.v2);
                let mut v3 = iv_setup(self.iv, counter.checked_add(i as u64).unwrap());
                self.rounds(&mut v0, &mut v1, &mut v2, &mut v3);
                for (ch, a) in chunk.chunks_exact_mut(0x10).zip(&[v0, v1, v2, v3]) {
                    let b = _mm_loadu_si128(ch.as_ptr() as *const __m128i);
                    let out = _mm_xor_si128(*a, b);
                    _mm_storeu_si128(ch.as_mut_ptr() as *mut __m128i, out);
                }
            }
        }
    }
pub fn apply_keystream ( & self , counter : u64 , output : & mut [ u8 ] ) { debug_assert_eq ! ( output len ( ) BUFFER_SIZE ) ; for ( i , chunk ) in output . chunks_exact_mut ( BLOCK_SIZE ) . enumerate ( ) { unsafe { let ( mut v0 , mut v1 , mut v2 ) = ( self . v0 , self . v1 , self . v2 ) ; let mut v3 = iv_setup ( self . iv , counter . checked_add ( i as u64 ) . unwrap ( ) ) ; self . rounds ( & mut v0 , & mut v1 , & mut v2 , & mut v3 ) ; for ( ch , a ) in chunk . chunks_exact_mut ( 0x10 ) . zip ( & [ v0 , v1 , v2 , v3 ] ) { let b = _mm_loadu_si128 ( ch . as_ptr ( ) as * const __m128i ) ; let out = _mm_xor_si128 ( * a , b ) ; _mm_storeu_si128 ( ch . as_mut_ptr ( ) as * mut __m128i , out ) ; } } } }
loadu/storeu support unaligned loads/stores
loadu / storeu support unaligned loads / stores
&self
counter
u64
output
&mut [u8]