PostGIS  3.1.6dev-r@@SVN_REVISION@@

◆ gserialized_gist_penalty_2d()

Datum gserialized_gist_penalty_2d ( PG_FUNCTION_ARGS  )

Definition at line 1233 of file gserialized_gist_2d.c.

1234 {
1235  GISTENTRY *origentry = (GISTENTRY*) PG_GETARG_POINTER(0);
1236  GISTENTRY *newentry = (GISTENTRY*) PG_GETARG_POINTER(1);
1237  float *result = (float*) PG_GETARG_POINTER(2);
1238  BOX2DF *b1, *b2;
1239 
1240  b1 = (BOX2DF *)DatumGetPointer(origentry->key);
1241  b2 = (BOX2DF *)DatumGetPointer(newentry->key);
1242 
1243  /* Penalty value of 0 has special code path in Postgres's gistchoose.
1244  * It is used as an early exit condition in subtree loop, allowing faster tree descend.
1245  * For multi-column index, it lets next column break the tie, possibly more confidently.
1246  */
1247  *result = 0;
1248 
1249  if (b1 && b2 && !box2df_is_empty(b1) && !box2df_is_empty(b2))
1250  *result = box2df_penalty(b1, b2);
1251 
1252  PG_RETURN_POINTER(result);
1253 }
char result[OUT_DOUBLE_BUFFER_SIZE]
Definition: cu_print.c:267
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: