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

Definition at line 175 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().

176 {
177  int i, dims_union, dims_new;
178  Assert(b_union);
179  Assert(*b_union);
180  Assert(b_new);
181 
182  /* Can't merge an unknown into any thing */
183  if( gidx_is_unknown(b_new) )
184  return;
185 
186  /* Merge of unknown and known is known */
187  if( gidx_is_unknown(*b_union) )
188  {
189  *b_union = b_new;
190  return;
191  }
192 
193  dims_union = GIDX_NDIMS(*b_union);
194  dims_new = GIDX_NDIMS(b_new);
195 
196  POSTGIS_DEBUGF(4, "merging gidx (%s) into gidx (%s)", gidx_to_string(b_new), gidx_to_string(*b_union));
197 
198  if ( dims_new > dims_union )
199  {
200  POSTGIS_DEBUGF(5, "reallocating b_union from %d dims to %d dims", dims_union, dims_new);
201  *b_union = (GIDX*)repalloc(*b_union, GIDX_SIZE(dims_new));
202  SET_VARSIZE(*b_union, VARSIZE(b_new));
203  dims_union = dims_new;
204  }
205 
206  for ( i = 0; i < dims_new; i++ )
207  {
208  /* Adjust minimums */
209  GIDX_SET_MIN(*b_union, i, Min(GIDX_GET_MIN(*b_union,i),GIDX_GET_MIN(b_new,i)));
210  /* Adjust maximums */
211  GIDX_SET_MAX(*b_union, i, Max(GIDX_GET_MAX(*b_union,i),GIDX_GET_MAX(b_new,i)));
212  }
213 
214  POSTGIS_DEBUGF(5, "merge complete (%s)", gidx_to_string(*b_union));
215  return;
216 }
static bool gidx_is_unknown(const GIDX *a)

Here is the call graph for this function:

Here is the caller graph for this function: