ref/include/f11_260.c
// Square a narrow residue and produce a wide result. The result is reduced to
// 32 bits but not narrowed for performance reasons.
Square a narrow residue and produce a wide result. The result is reduced to
32 bits but not narrowed for performance reasons.
Square a narrow residue and produce a wide result . The result is reduced to 32 bits but not narrowed for performance reasons .
void square_narrow(
  residue_narrow_t *result, const residue_narrow_t *x) {
  residue_wide_t temp;
  for (int i = 0; i < NLIMBS; ++i) {
    temp.limbs[i] = 0;
    int i_2 = (i + (-(i & 1) & NLIMBS)) >> 1;
    for (int j = 1; j <= NLIMBS / 2; ++ j) {
      temp.limbs[i] -=
        ((int64_t) (x->limbs[wrap(i_2 + j)] - x->limbs[wrap(i_2 - j)])) *
        ((int64_t) (x->limbs[wrap(i_2 + j)] - x->limbs[wrap(i_2 - j)]));
    }
  }
  reduce_step_wide(&temp, &temp);
  reduce_step_wide(&temp, &temp);
  narrow(result, &temp);
}
void square_narrow ( residue_narrow_t * result , const residue_narrow_t * x ) { residue_wide_t temp ; for ( int i = 0 ; i < NLIMBS ; ++ i ) { temp . limbs [ i ] = 0 ; int i_2 = ( i + ( - ( i & 1 ) & NLIMBS ) ) >> 1 ; for ( int j = 1 ; j <= NLIMBS / 2 ; ++ j ) { temp . limbs [ i ] -= ( ( int64_t ) ( x -> limbs [ wrap ( i_2 + j ) ] - x -> limbs [ wrap ( i_2 - j ) ] ) ) * ( ( int64_t ) ( x -> limbs [ wrap ( i_2 + j ) ] - x -> limbs [ wrap ( i_2 - j ) ] ) ) ; } } reduce_step_wide ( & temp , & temp ) ; reduce_step_wide ( & temp , & temp ) ; narrow ( result , & temp ) ; }
Square a narrow residue and produce a wide result.
Square a narrow residue and produce a wide result .