PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ pivot()

static double pivot ( double *  left,
double *  right 
)
static

Definition at line 40 of file rt_statistics.c.

References ORDER, and r.

Referenced by quicksort().

40  {
41  double l, m, r, *p;
42 
43  l = *left;
44  m = *(left + (right - left) / 2);
45  r = *right;
46 
47  /* order */
48  ORDER(l, m);
49  ORDER(l, r);
50  ORDER(m, r);
51 
52  /* pivot is higher of two values */
53  if (l < m) return m;
54  if (m < r) return r;
55 
56  /* find pivot that isn't left */
57  for (p = left + 1; p <= right; ++p) {
58  if (*p != *left)
59  return (*p < *left) ? *left : *p;
60  }
61 
62  /* all values are same */
63  return -1;
64 }
#define ORDER(x, y)
Definition: rt_statistics.c:38
char * r
Definition: cu_in_wkt.c:24
Here is the caller graph for this function: