PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ gserialized_gist_penalty_2d()

Datum gserialized_gist_penalty_2d ( PG_FUNCTION_ARGS  )

Definition at line 1186 of file gserialized_gist_2d.c.

1187 {
1188  GISTENTRY *origentry = (GISTENTRY*) PG_GETARG_POINTER(0);
1189  GISTENTRY *newentry = (GISTENTRY*) PG_GETARG_POINTER(1);
1190  float *result = (float*) PG_GETARG_POINTER(2);
1191  BOX2DF *b1, *b2;
1192 
1193  b1 = (BOX2DF *)DatumGetPointer(origentry->key);
1194  b2 = (BOX2DF *)DatumGetPointer(newentry->key);
1195 
1196  /* Penalty value of 0 has special code path in Postgres's gistchoose.
1197  * It is used as an early exit condition in subtree loop, allowing faster tree descend.
1198  * For multi-column index, it lets next column break the tie, possibly more confidently.
1199  */
1200  *result = 0;
1201 
1202  if (b1 && b2 && !box2df_is_empty(b1) && !box2df_is_empty(b2))
1203  *result = box2df_penalty(b1, b2);
1204 
1205  PG_RETURN_POINTER(result);
1206 }
bool box2df_is_empty(const BOX2DF *a)
static float box2df_penalty(const BOX2DF *b1, const BOX2DF *b2)

References box2df_is_empty(), and box2df_penalty().

Here is the call graph for this function: