diff options
author | Nathan Bossart <nathan@postgresql.org> | 2024-02-16 14:05:36 -0600 |
---|---|---|
committer | Nathan Bossart <nathan@postgresql.org> | 2024-02-16 14:05:36 -0600 |
commit | 3b42bdb47169c617cb79123c407a19d16458b49a (patch) | |
tree | 90b3448bf3d59ab3bdc5996f2bb43fc83bcfe458 /contrib/intarray/_intbig_gist.c | |
parent | 6b80394781c8de17fe7cae6996476088af3c319f (diff) | |
download | postgresql-3b42bdb47169c617cb79123c407a19d16458b49a.tar.gz postgresql-3b42bdb47169c617cb79123c407a19d16458b49a.zip |
Use new overflow-safe integer comparison functions.
Commit 6b80394781 introduced integer comparison functions designed
to be as efficient as possible while avoiding overflow. This
commit makes use of these functions in many of the in-tree qsort()
comparators to help ensure transitivity. Many of these comparator
functions should also see a small performance boost.
Author: Mats Kindahl
Reviewed-by: Andres Freund, FabrÃzio de Royes Mello
Discussion: https://postgr.es/m/CA%2B14426g2Wa9QuUpmakwPxXFWG_1FaY0AsApkvcTBy-YfS6uaw%40mail.gmail.com
Diffstat (limited to 'contrib/intarray/_intbig_gist.c')
-rw-r--r-- | contrib/intarray/_intbig_gist.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/contrib/intarray/_intbig_gist.c b/contrib/intarray/_intbig_gist.c index 8c6c4b5d051..9699fbf3b4f 100644 --- a/contrib/intarray/_intbig_gist.c +++ b/contrib/intarray/_intbig_gist.c @@ -9,6 +9,7 @@ #include "access/gist.h" #include "access/reloptions.h" #include "access/stratnum.h" +#include "common/int.h" #include "port/pg_bitutils.h" #define GETENTRY(vec,pos) ((GISTTYPE *) DatumGetPointer((vec)->vector[(pos)].key)) @@ -312,7 +313,8 @@ typedef struct static int comparecost(const void *a, const void *b) { - return ((const SPLITCOST *) a)->cost - ((const SPLITCOST *) b)->cost; + return pg_cmp_s32(((const SPLITCOST *) a)->cost, + ((const SPLITCOST *) b)->cost); } |