PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ gserialized_gist_penalty_2d()

Datum gserialized_gist_penalty_2d ( PG_FUNCTION_ARGS  )

Definition at line 1289 of file gserialized_gist_2d.c.

1290{
1291 GISTENTRY *origentry = (GISTENTRY*) PG_GETARG_POINTER(0);
1292 GISTENTRY *newentry = (GISTENTRY*) PG_GETARG_POINTER(1);
1293 float *result = (float*) PG_GETARG_POINTER(2);
1294 BOX2DF *b1, *b2;
1295
1296 b1 = (BOX2DF *)DatumGetPointer(origentry->key);
1297 b2 = (BOX2DF *)DatumGetPointer(newentry->key);
1298
1299 /* Penalty value of 0 has special code path in Postgres's gistchoose.
1300 * It is used as an early exit condition in subtree loop, allowing faster tree descend.
1301 * For multi-column index, it lets next column break the tie, possibly more confidently.
1302 */
1303 *result = 0;
1304
1305 if (b1 && b2 && !box2df_is_empty(b1) && !box2df_is_empty(b2))
1306 *result = box2df_penalty(b1, b2);
1307
1308 PG_RETURN_POINTER(result);
1309}
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: