references/NIST-PQ-Submission-Kyber-20201001/Additional_Implementations/avx2/crypto_kem/kyber768/poly.c
/*************************************************
* Name:        poly_sub
*
* Description: Subtract two polynomials
*
* Arguments: - poly *r:       pointer to output polynomial
*            - const poly *a: pointer to first input polynomial
*            - const poly *b: pointer to second input polynomial
**************************************************/
poly_sub
Description: Subtract two polynomials

- poly *r:       pointer to output polynomial
const poly *a: pointer to first input polynomial
const poly *b: pointer to second input polynomial
poly_sub Description : Subtract two polynomials - poly * r : pointer to output polynomial const poly * a : pointer to first input polynomial const poly * b : pointer to second input polynomial
void poly_sub(poly *r, const poly *a, const poly *b)
{
  unsigned int i;
  __m256i f0, f1;
  for(i=0;i<KYBER_N;i+=16) {
    f0 = _mm256_load_si256((__m256i *)&a->coeffs[i]);
    f1 = _mm256_load_si256((__m256i *)&b->coeffs[i]);
    f0 = _mm256_sub_epi16(f0, f1);
    _mm256_store_si256((__m256i *)&r->coeffs[i], f0);
  }
}
void poly_sub ( poly * r , const poly * a , const poly * b ) { unsigned int i ; __m256i f0 , f1 ; for ( i = 0 ; i < KYBER_N ; i += 16 ) { f0 = _mm256_load_si256 ( ( __m256i * ) & a -> coeffs [ i ] ) ; f1 = _mm256_load_si256 ( ( __m256i * ) & b -> coeffs [ i ] ) ; f0 = _mm256_sub_epi16 ( f0 , f1 ) ; _mm256_store_si256 ( ( __m256i * ) & r -> coeffs [ i ] , f0 ) ; } }
Name:        poly_sub
Description: Subtract two polynomials
Name : poly_sub Description : Subtract two polynomials