PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ gserialized_gist_penalty_2d()

Datum gserialized_gist_penalty_2d ( PG_FUNCTION_ARGS  )

Definition at line 1249 of file gserialized_gist_2d.c.

1250 {
1251  GISTENTRY *origentry = (GISTENTRY*) PG_GETARG_POINTER(0);
1252  GISTENTRY *newentry = (GISTENTRY*) PG_GETARG_POINTER(1);
1253  float *result = (float*) PG_GETARG_POINTER(2);
1254  BOX2DF *b1, *b2;
1255 
1256  b1 = (BOX2DF *)DatumGetPointer(origentry->key);
1257  b2 = (BOX2DF *)DatumGetPointer(newentry->key);
1258 
1259  /* Penalty value of 0 has special code path in Postgres's gistchoose.
1260  * It is used as an early exit condition in subtree loop, allowing faster tree descend.
1261  * For multi-column index, it lets next column break the tie, possibly more confidently.
1262  */
1263  *result = 0;
1264 
1265  if (b1 && b2 && !box2df_is_empty(b1) && !box2df_is_empty(b2))
1266  *result = box2df_penalty(b1, b2);
1267 
1268  PG_RETURN_POINTER(result);
1269 }
char result[OUT_DOUBLE_BUFFER_SIZE]
Definition: cu_print.c:262
bool box2df_is_empty(const BOX2DF *a)
static float box2df_penalty(const BOX2DF *b1, const BOX2DF *b2)

References box2df_is_empty(), box2df_penalty(), and result.

Here is the call graph for this function: