PostGIS  2.1.10dev-r@@SVN_REVISION@@
static void gidx_merge ( GIDX **  b_union,
GIDX *  b_new 
)
static

Definition at line 140 of file gserialized_gist_nd.c.

References gidx_is_unknown().

Referenced by gserialized_gist_picksplit(), gserialized_gist_picksplit_addlist(), gserialized_gist_picksplit_constructsplit(), gserialized_gist_picksplit_fallback(), and gserialized_gist_union().

141 {
142  int i, dims_union, dims_new;
143  Assert(b_union);
144  Assert(*b_union);
145  Assert(b_new);
146 
147  /* Can't merge an unknown into any thing */
148  if( gidx_is_unknown(b_new) )
149  return;
150 
151  /* Merge of unknown and known is known */
152  if( gidx_is_unknown(*b_union) )
153  {
154  *b_union = b_new;
155  return;
156  }
157 
158  dims_union = GIDX_NDIMS(*b_union);
159  dims_new = GIDX_NDIMS(b_new);
160 
161  POSTGIS_DEBUGF(4, "merging gidx (%s) into gidx (%s)", gidx_to_string(b_new), gidx_to_string(*b_union));
162 
163  if ( dims_new > dims_union )
164  {
165  POSTGIS_DEBUGF(5, "reallocating b_union from %d dims to %d dims", dims_union, dims_new);
166  *b_union = (GIDX*)repalloc(*b_union, GIDX_SIZE(dims_new));
167  SET_VARSIZE(*b_union, VARSIZE(b_new));
168  dims_union = dims_new;
169  }
170 
171  for ( i = 0; i < dims_new; i++ )
172  {
173  /* Adjust minimums */
174  GIDX_SET_MIN(*b_union, i, Min(GIDX_GET_MIN(*b_union,i),GIDX_GET_MIN(b_new,i)));
175  /* Adjust maximums */
176  GIDX_SET_MAX(*b_union, i, Max(GIDX_GET_MAX(*b_union,i),GIDX_GET_MAX(b_new,i)));
177  }
178 
179  POSTGIS_DEBUGF(5, "merge complete (%s)", gidx_to_string(*b_union));
180  return;
181 }
static bool gidx_is_unknown(const GIDX *a)

Here is the call graph for this function:

Here is the caller graph for this function: