summaryrefslogtreecommitdiff
path: root/contrib/btree_gist/btree_macaddr.c
diff options
context:
space:
mode:
authorTeodor Sigaev2005-07-01 13:44:56 +0000
committerTeodor Sigaev2005-07-01 13:44:56 +0000
commitef770cbb6913cc4c816bb09acd7cb13f996281bd (patch)
treefe973e6aeb9c018d54ea6267f49d5d1b2d5d2f95 /contrib/btree_gist/btree_macaddr.c
parent8f6e8e8fed372a592f645d8900b6f456db82cc59 (diff)
Fixes from Janko Richter <[email protected]>
- Fix wrong index results on text, char, varchar for multibyte strings - Fix some SIGFPE signals - Add support for infinite timestamps - Because of locale settings, btree_gist can not be a prefix index anymore (for text). Each node holds now just the lower and upper boundary.
Diffstat (limited to 'contrib/btree_gist/btree_macaddr.c')
-rw-r--r--contrib/btree_gist/btree_macaddr.c12
1 files changed, 1 insertions, 11 deletions
diff --git a/contrib/btree_gist/btree_macaddr.c b/contrib/btree_gist/btree_macaddr.c
index 3f08a586556..ee56f0fac1f 100644
--- a/contrib/btree_gist/btree_macaddr.c
+++ b/contrib/btree_gist/btree_macaddr.c
@@ -151,23 +151,13 @@ gbt_macad_penalty(PG_FUNCTION_ARGS)
float *result = (float *) PG_GETARG_POINTER(2);
uint64 iorg[2],
inew[2];
- uint64 res;
iorg[0] = mac_2_uint64(&origentry->lower);
iorg[1] = mac_2_uint64(&origentry->upper);
inew[0] = mac_2_uint64(&newentry->lower);
inew[1] = mac_2_uint64(&newentry->upper);
- penalty_range_enlarge(iorg[0], iorg[1], inew[0], inew[1]);
-
- *result = 0.0;
-
- if (res > 0)
- {
- *result += FLT_MIN;
- *result += (float) (((double) res) / ((double) res + (double) iorg[1] - (double) iorg[0]));
- *result *= (FLT_MAX / (((GISTENTRY *) PG_GETARG_POINTER(0))->rel->rd_att->natts + 1));
- }
+ penalty_num(result,iorg[0],iorg[1],inew[0],inew[1]);
PG_RETURN_POINTER(result);