mirror of
https://github.com/postgres/postgres.git
synced 2025-06-17 17:02:08 +03:00
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
This commit is contained in:
@ -27,6 +27,7 @@
|
||||
#include "common/blkreftable.h"
|
||||
#include "common/parse_manifest.h"
|
||||
#include "common/hashfn.h"
|
||||
#include "common/int.h"
|
||||
#include "postmaster/walsummarizer.h"
|
||||
|
||||
#define BLOCKS_PER_READ 512
|
||||
@ -994,10 +995,5 @@ compare_block_numbers(const void *a, const void *b)
|
||||
BlockNumber aa = *(BlockNumber *) a;
|
||||
BlockNumber bb = *(BlockNumber *) b;
|
||||
|
||||
if (aa > bb)
|
||||
return 1;
|
||||
else if (aa == bb)
|
||||
return 0;
|
||||
else
|
||||
return -1;
|
||||
return pg_cmp_u32(aa, bb);
|
||||
}
|
||||
|
Reference in New Issue
Block a user