summaryrefslogtreecommitdiff
path: root/contrib/btree_gist/btree_ts.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2025-08-13 17:18:13 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2025-08-13 17:18:22 -0400
commitee54046601de2d14ca9107ba04c50178d9b52fe6 (patch)
tree3950eafde3f8a7bc96cb47741942962abe3ac2c6 /contrib/btree_gist/btree_ts.c
parent6aebedc38497ecebda22caf61bcadf78a8331b52 (diff)
Grab the low-hanging fruit from forcing USE_FLOAT8_BYVAL to true.HEADorigin/masterorigin/HEADmaster
Remove conditionally-compiled code for the other case. Replace uses of FLOAT8PASSBYVAL with constant "true", mainly because it was quite confusing in cases where the type we were dealing with wasn't float8. I left the associated pg_control and Pg_magic_struct fields in place. Perhaps we should get rid of them, but it would save little, so it doesn't seem worth thinking hard about the compatibility implications. I just labeled them "vestigial" in places where that seemed helpful. Author: Tom Lane <tgl@sss.pgh.pa.us> Reviewed-by: Peter Eisentraut <peter@eisentraut.org> Discussion: https://postgr.es/m/1749799.1752797397@sss.pgh.pa.us
Diffstat (limited to 'contrib/btree_gist/btree_ts.c')
-rw-r--r--contrib/btree_gist/btree_ts.c39
1 files changed, 16 insertions, 23 deletions
diff --git a/contrib/btree_gist/btree_ts.c b/contrib/btree_gist/btree_ts.c
index eb899c4d213..1e8f83f0f0a 100644
--- a/contrib/btree_gist/btree_ts.c
+++ b/contrib/btree_gist/btree_ts.c
@@ -33,13 +33,6 @@ PG_FUNCTION_INFO_V1(gbt_ts_same);
PG_FUNCTION_INFO_V1(gbt_ts_sortsupport);
-#ifdef USE_FLOAT8_BYVAL
-#define TimestampGetDatumFast(X) TimestampGetDatum(X)
-#else
-#define TimestampGetDatumFast(X) PointerGetDatum(&(X))
-#endif
-
-
/* define for comparison */
static bool
@@ -49,8 +42,8 @@ gbt_tsgt(const void *a, const void *b, FmgrInfo *flinfo)
const Timestamp *bb = (const Timestamp *) b;
return DatumGetBool(DirectFunctionCall2(timestamp_gt,
- TimestampGetDatumFast(*aa),
- TimestampGetDatumFast(*bb)));
+ TimestampGetDatum(*aa),
+ TimestampGetDatum(*bb)));
}
static bool
@@ -60,8 +53,8 @@ gbt_tsge(const void *a, const void *b, FmgrInfo *flinfo)
const Timestamp *bb = (const Timestamp *) b;
return DatumGetBool(DirectFunctionCall2(timestamp_ge,
- TimestampGetDatumFast(*aa),
- TimestampGetDatumFast(*bb)));
+ TimestampGetDatum(*aa),
+ TimestampGetDatum(*bb)));
}
static bool
@@ -71,8 +64,8 @@ gbt_tseq(const void *a, const void *b, FmgrInfo *flinfo)
const Timestamp *bb = (const Timestamp *) b;
return DatumGetBool(DirectFunctionCall2(timestamp_eq,
- TimestampGetDatumFast(*aa),
- TimestampGetDatumFast(*bb)));
+ TimestampGetDatum(*aa),
+ TimestampGetDatum(*bb)));
}
static bool
@@ -82,8 +75,8 @@ gbt_tsle(const void *a, const void *b, FmgrInfo *flinfo)
const Timestamp *bb = (const Timestamp *) b;
return DatumGetBool(DirectFunctionCall2(timestamp_le,
- TimestampGetDatumFast(*aa),
- TimestampGetDatumFast(*bb)));
+ TimestampGetDatum(*aa),
+ TimestampGetDatum(*bb)));
}
static bool
@@ -93,8 +86,8 @@ gbt_tslt(const void *a, const void *b, FmgrInfo *flinfo)
const Timestamp *bb = (const Timestamp *) b;
return DatumGetBool(DirectFunctionCall2(timestamp_lt,
- TimestampGetDatumFast(*aa),
- TimestampGetDatumFast(*bb)));
+ TimestampGetDatum(*aa),
+ TimestampGetDatum(*bb)));
}
static int
@@ -104,9 +97,9 @@ gbt_tskey_cmp(const void *a, const void *b, FmgrInfo *flinfo)
tsKEY *ib = (tsKEY *) (((const Nsrt *) b)->t);
int res;
- res = DatumGetInt32(DirectFunctionCall2(timestamp_cmp, TimestampGetDatumFast(ia->lower), TimestampGetDatumFast(ib->lower)));
+ res = DatumGetInt32(DirectFunctionCall2(timestamp_cmp, TimestampGetDatum(ia->lower), TimestampGetDatum(ib->lower)));
if (res == 0)
- return DatumGetInt32(DirectFunctionCall2(timestamp_cmp, TimestampGetDatumFast(ia->upper), TimestampGetDatumFast(ib->upper)));
+ return DatumGetInt32(DirectFunctionCall2(timestamp_cmp, TimestampGetDatum(ia->upper), TimestampGetDatum(ib->upper)));
return res;
}
@@ -122,8 +115,8 @@ gbt_ts_dist(const void *a, const void *b, FmgrInfo *flinfo)
return get_float8_infinity();
i = DatumGetIntervalP(DirectFunctionCall2(timestamp_mi,
- TimestampGetDatumFast(*aa),
- TimestampGetDatumFast(*bb)));
+ TimestampGetDatum(*aa),
+ TimestampGetDatum(*bb)));
return fabs(INTERVAL_TO_SEC(i));
}
@@ -404,8 +397,8 @@ gbt_ts_ssup_cmp(Datum x, Datum y, SortSupport ssup)
/* for leaf items we expect lower == upper, so only compare lower */
return DatumGetInt32(DirectFunctionCall2(timestamp_cmp,
- TimestampGetDatumFast(arg1->lower),
- TimestampGetDatumFast(arg2->lower)));
+ TimestampGetDatum(arg1->lower),
+ TimestampGetDatum(arg2->lower)));
}
Datum