PostgreSQL Source Code
git master
Toggle main menu visibility
Main Page
Related Pages
Namespaces
Namespace List
Namespace Members
All
a
c
d
g
h
i
k
l
m
p
r
s
t
Functions
Variables
Data Structures
Data Structures
Data Structure Index
Class Hierarchy
Data Fields
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
c
d
f
h
i
n
o
p
r
s
t
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerations
Files
File List
Globals
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerations
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Enumerator
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Macros
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
•
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Pages
pg_crc32c_armv8.c
Go to the documentation of this file.
1
/*-------------------------------------------------------------------------
2
*
3
* pg_crc32c_armv8.c
4
* Compute CRC-32C checksum using ARMv8 CRC Extension instructions
5
*
6
* Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
7
* Portions Copyright (c) 1994, Regents of the University of California
8
*
9
*
10
* IDENTIFICATION
11
* src/port/pg_crc32c_armv8.c
12
*
13
*-------------------------------------------------------------------------
14
*/
15
#include "
c.h
"
16
17
#include <arm_acle.h>
18
19
#include "
port/pg_crc32c.h
"
20
21
pg_crc32c
22
pg_comp_crc32c_armv8
(
pg_crc32c
crc
,
const
void
*
data
,
size_t
len
)
23
{
24
const
unsigned
char
*p =
data
;
25
const
unsigned
char
*
pend
= p +
len
;
26
27
/*
28
* ARMv8 doesn't require alignment, but aligned memory access is
29
* significantly faster. Process leading bytes so that the loop below
30
* starts with a pointer aligned to eight bytes.
31
*/
32
if
(!
PointerIsAligned
(p,
uint16
) &&
33
p + 1 <=
pend
)
34
{
35
crc
= __crc32cb(
crc
, *p);
36
p += 1;
37
}
38
if
(!
PointerIsAligned
(p,
uint32
) &&
39
p + 2 <=
pend
)
40
{
41
crc
= __crc32ch(
crc
, *(
uint16
*) p);
42
p += 2;
43
}
44
if
(!
PointerIsAligned
(p,
uint64
) &&
45
p + 4 <=
pend
)
46
{
47
crc
= __crc32cw(
crc
, *(
uint32
*) p);
48
p += 4;
49
}
50
51
/* Process eight bytes at a time, as far as we can. */
52
while
(p + 8 <=
pend
)
53
{
54
crc
= __crc32cd(
crc
, *(
uint64
*) p);
55
p += 8;
56
}
57
58
/* Process remaining 0-7 bytes. */
59
if
(p + 4 <=
pend
)
60
{
61
crc
= __crc32cw(
crc
, *(
uint32
*) p);
62
p += 4;
63
}
64
if
(p + 2 <=
pend
)
65
{
66
crc
= __crc32ch(
crc
, *(
uint16
*) p);
67
p += 2;
68
}
69
if
(p <
pend
)
70
{
71
crc
= __crc32cb(
crc
, *p);
72
}
73
74
return
crc
;
75
}
c.h
PointerIsAligned
#define PointerIsAligned(pointer, type)
Definition:
c.h:740
uint64
uint64_t uint64
Definition:
c.h:503
uint16
uint16_t uint16
Definition:
c.h:501
uint32
uint32_t uint32
Definition:
c.h:502
pg_crc32c.h
pg_crc32c
uint32 pg_crc32c
Definition:
pg_crc32c.h:38
pg_comp_crc32c_armv8
pg_crc32c pg_comp_crc32c_armv8(pg_crc32c crc, const void *data, size_t len)
Definition:
pg_crc32c_armv8.c:22
len
const void size_t len
Definition:
pg_crc32c_sse42.c:28
data
const void * data
Definition:
pg_crc32c_sse42.c:27
crc
return crc
Definition:
pg_crc32c_sse42.c:72
pend
const unsigned char * pend
Definition:
pg_crc32c_sse42.c:30
src
port
pg_crc32c_armv8.c
Generated on Thu Apr 24 2025 00:13:29 for PostgreSQL Source Code by
1.9.4