diff options
| author | Nathan Bossart | 2024-02-16 20:05:36 +0000 |
|---|---|---|
| committer | Nathan Bossart | 2024-02-16 20:05:36 +0000 |
| commit | 3b42bdb47169c617cb79123c407a19d16458b49a (patch) | |
| tree | 90b3448bf3d59ab3bdc5996f2bb43fc83bcfe458 /src/include/access | |
| parent | 6b80394781c8de17fe7cae6996476088af3c319f (diff) | |
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 'src/include/access')
| -rw-r--r-- | src/include/access/gin_private.h | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/include/access/gin_private.h b/src/include/access/gin_private.h index 51d0c74a6b0..3013a44bae1 100644 --- a/src/include/access/gin_private.h +++ b/src/include/access/gin_private.h @@ -14,6 +14,7 @@ #include "access/gin.h" #include "access/ginblock.h" #include "access/itup.h" +#include "common/int.h" #include "catalog/pg_am_d.h" #include "fmgr.h" #include "lib/rbtree.h" @@ -489,12 +490,7 @@ ginCompareItemPointers(ItemPointer a, ItemPointer b) uint64 ia = (uint64) GinItemPointerGetBlockNumber(a) << 32 | GinItemPointerGetOffsetNumber(a); uint64 ib = (uint64) GinItemPointerGetBlockNumber(b) << 32 | GinItemPointerGetOffsetNumber(b); - if (ia == ib) - return 0; - else if (ia > ib) - return 1; - else - return -1; + return pg_cmp_u64(ia, ib); } extern int ginTraverseLock(Buffer buffer, bool searchMode); |
