aboutsummaryrefslogtreecommitdiff
path: root/contrib/btree_gist/btree_cash.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/btree_gist/btree_cash.c')
-rw-r--r--contrib/btree_gist/btree_cash.c17
1 files changed, 3 insertions, 14 deletions
diff --git a/contrib/btree_gist/btree_cash.c b/contrib/btree_gist/btree_cash.c
index 84e46101181..cef61037349 100644
--- a/contrib/btree_gist/btree_cash.c
+++ b/contrib/btree_gist/btree_cash.c
@@ -125,21 +125,10 @@ Datum
gbt_cash_penalty(PG_FUNCTION_ARGS)
{
cashKEY *origentry = (cashKEY *) DatumGetPointer(((GISTENTRY *) PG_GETARG_POINTER(0))->key);
- cashKEY *newentry = (cashKEY *) DatumGetPointer(((GISTENTRY *) PG_GETARG_POINTER(1))->key);
- float *result = (float *) PG_GETARG_POINTER(2);
+ cashKEY *newentry = (cashKEY *) DatumGetPointer(((GISTENTRY *) PG_GETARG_POINTER(1))->key);
+ float *result = (float *) PG_GETARG_POINTER(2);
- Cash res;
-
- *result = 0.0;
-
- penalty_range_enlarge(origentry->lower, origentry->upper, newentry->lower, newentry->upper);
-
- if (res > 0)
- {
- *result += FLT_MIN;
- *result += (float) (res / ((double) (res + origentry->upper - origentry->lower)));
- *result *= (FLT_MAX / (((GISTENTRY *) PG_GETARG_POINTER(0))->rel->rd_att->natts + 1));
- }
+ penalty_num(result,origentry->lower,origentry->upper,newentry->lower,newentry->upper);
PG_RETURN_POINTER(result);