lopy4/components/Bliss-master/ntt_variants/red_bounds.c
/*
 * Bounds after a GS step with a fixed w
 */
Bounds after a GS step with a fixed w
Bounds after a GS step with a fixed w
int64_t gs_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(-2*b, 2*b, w, &min_y);
  max_r = max_red_mul(-2*b, 2*b, w, &max_y);
  b1 = (max_r < 0) ? -min_r : (min_r > 0) ? max_r : (max_r > -min_r) ? max_r : -min_r;
  b2 = 2 * b;
  return (b1 < b2) ? b2 : b1;
}
int64_t gs_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 ( -2 * b , 2 * b , w , & min_y ) ; max_r = max_red_mul ( -2 * b , 2 * b , w , & max_y ) ; b1 = ( max_r < 0 ) ? - min_r : ( min_r > 0 ) ? max_r : ( max_r > - min_r ) ? max_r : - min_r ; b2 = 2 * b ; return ( b1 < b2 ) ? b2 : b1 ; }
Bounds after a GS step with a fixed w
Bounds after a GS step with a fixed w
// min and max or red(w * (x -y)) given |x - y| <= 2b // we have min_r <= y' <= max_r and -2b <= x <= 2b  // b1 = bound on |y'|, b2 = boud on |x'|