lopy4/components/Bliss-master/ntt_variants/red_bounds.c
/*
 * Bounds after a CT step with a fixed w
 */
Bounds after a CT step with a fixed w
Bounds after a CT step with a fixed w
int64_t ct_bound_fixed(int64_t b, int64_t w) {
  int64_t min_r, max_r, min_y, max_y, b1, b2;
  assert(b >= 0);
  min_r = min_red_mul(-b, b, w, &min_y);
  max_r = max_red_mul(-b, b, w, &max_y);
  b1 = b + max_r;
  b2 = b - min_r;
  if (b1 < 0) b1 = -b1;
  if (b2 < 0) b2 = -b2;
  return (b1 < b2) ? b2 : b1;
}
int64_t ct_bound_fixed ( int64_t b , int64_t w ) { int64_t min_r , max_r , min_y , max_y , b1 , b2 ; assert ( b >= 0 ) ; min_r = min_red_mul ( - b , b , w , & min_y ) ; max_r = max_red_mul ( - b , b , w , & max_y ) ; b1 = b + max_r ; b2 = b - min_r ; if ( b1 < 0 ) b1 = - b1 ; if ( b2 < 0 ) b2 = - b2 ; return ( b1 < b2 ) ? b2 : b1 ; }
Bounds after a CT step with a fixed w
Bounds after a CT step with a fixed w
// min and max or red(w * y) for -b <= y <= b // we have -b + min_r <= x' <= b + max_r // and     -b - max_r <= y' <= b - min_r