PostgreSQL Source Code git master
Loading...
Searching...
No Matches
checksum.c
Go to the documentation of this file.
1/*-------------------------------------------------------------------------
2 *
3 * checksum.c
4 * Checksum implementation for data pages.
5 *
6 * Portions Copyright (c) 1996-2026, PostgreSQL Global Development Group
7 * Portions Copyright (c) 1994, Regents of the University of California
8 *
9 * IDENTIFICATION
10 * src/backend/storage/page/checksum.c
11 *
12 *-------------------------------------------------------------------------
13 */
14#include "postgres.h"
15
16#include "port/pg_cpu.h"
17#include "storage/checksum.h"
18/*
19 * The actual code is in storage/checksum_impl.h. This is done so that
20 * external programs can incorporate the checksum code by #include'ing
21 * that file from the exported Postgres headers. (Compare our legacy
22 * CRC code in pg_crc.h.)
23 * The PG_CHECKSUM_INTERNAL symbol allows core to use hardware-specific
24 * coding without affecting external programs.
25 */
26#define PG_CHECKSUM_INTERNAL
27#include "storage/checksum_impl.h" /* IWYU pragma: keep */
28
29
30static uint32
35
36/*
37 * AVX2-optimized block checksum algorithm.
38 */
39#ifdef USE_AVX2_WITH_RUNTIME_CHECK
43{
45}
46#endif /* USE_AVX2_WITH_RUNTIME_CHECK */
47
48/*
49 * Choose the best available checksum implementation.
50 */
51static uint32
53{
55
56#ifdef USE_AVX2_WITH_RUNTIME_CHECK
59#endif
60
61 return pg_checksum_block(page);
62}
63
uint32_t uint32
Definition c.h:624
#define pg_attribute_target(...)
Definition c.h:238
static uint32 pg_checksum_choose(const PGChecksummablePage *page)
Definition checksum.c:52
static uint32 pg_checksum_block_fallback(const PGChecksummablePage *page)
Definition checksum.c:31
static uint32(* pg_checksum_block)(const PGChecksummablePage *page)
Definition checksum.c:64
static int fb(int x)