Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit404bc51

Browse files
committed
Remove support for 64-bit CRC.
It hasn't been used for anything for a long time.
1 parent585e0b9 commit404bc51

File tree

2 files changed

+0
-512
lines changed

2 files changed

+0
-512
lines changed

‎src/include/utils/pg_crc.h

Lines changed: 0 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@
1010
* We use a normal (not "reflected", in Williams' terms) CRC, using initial
1111
* all-ones register contents and a final bit inversion.
1212
*
13-
* The 64-bit variant is not used as of PostgreSQL 8.1, but we retain the
14-
* code for possible future use.
15-
*
1613
*
1714
* Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group
1815
* Portions Copyright (c) 1994, Regents of the University of California
@@ -56,97 +53,4 @@ do { \
5653
/* Constant table for CRC calculation */
5754
externCRCDLLIMPORTconstuint32pg_crc32_table[];
5855

59-
60-
#ifdefPROVIDE_64BIT_CRC
61-
62-
/*
63-
* If we use a 64-bit integer type, then a 64-bit CRC looks just like the
64-
* usual sort of implementation. However, we can also fake it with two
65-
* 32-bit registers. Experience has shown that the two-32-bit-registers code
66-
* is as fast as, or even much faster than, the 64-bit code on all but true
67-
* 64-bit machines. We use SIZEOF_VOID_P to check the native word width.
68-
*/
69-
70-
#ifSIZEOF_VOID_P<8
71-
72-
/*
73-
* crc0 represents the LSBs of the 64-bit value, crc1 the MSBs. Note that
74-
* with crc0 placed first, the output of 32-bit and 64-bit implementations
75-
* will be bit-compatible only on little-endian architectures. If it were
76-
* important to make the two possible implementations bit-compatible on
77-
* all machines, we could do a configure test to decide how to order the
78-
* two fields, but it seems not worth the trouble.
79-
*/
80-
typedefstructpg_crc64
81-
{
82-
uint32crc0;
83-
uint32crc1;
84-
}pg_crc64;
85-
86-
/* Initialize a CRC accumulator */
87-
#defineINIT_CRC64(crc) ((crc).crc0 = 0xffffffff, (crc).crc1 = 0xffffffff)
88-
89-
/* Finish a CRC calculation */
90-
#defineFIN_CRC64(crc)((crc).crc0 ^= 0xffffffff, (crc).crc1 ^= 0xffffffff)
91-
92-
/* Accumulate some (more) bytes into a CRC */
93-
#defineCOMP_CRC64(crc,data,len)\
94-
do { \
95-
uint32__crc0 = (crc).crc0; \
96-
uint32__crc1 = (crc).crc1; \
97-
unsigned char *__data = (unsigned char *) (data); \
98-
uint32__len = (len); \
99-
\
100-
while (__len-- > 0) \
101-
{ \
102-
int__tab_index = ((int) (__crc1 >> 24) ^ *__data++) & 0xFF; \
103-
__crc1 = pg_crc64_table1[__tab_index] ^ ((__crc1 << 8) | (__crc0 >> 24)); \
104-
__crc0 = pg_crc64_table0[__tab_index] ^ (__crc0 << 8); \
105-
} \
106-
(crc).crc0 = __crc0; \
107-
(crc).crc1 = __crc1; \
108-
} while (0)
109-
110-
/* Check for equality of two CRCs */
111-
#defineEQ_CRC64(c1,c2) ((c1).crc0 == (c2).crc0 && (c1).crc1 == (c2).crc1)
112-
113-
/* Constant table for CRC calculation */
114-
externCRCDLLIMPORTconstuint32pg_crc64_table0[];
115-
externCRCDLLIMPORTconstuint32pg_crc64_table1[];
116-
#else/* use int64 implementation */
117-
118-
typedefstructpg_crc64
119-
{
120-
uint64crc0;
121-
}pg_crc64;
122-
123-
/* Initialize a CRC accumulator */
124-
#defineINIT_CRC64(crc) ((crc).crc0 = UINT64CONST(0xffffffffffffffff))
125-
126-
/* Finish a CRC calculation */
127-
#defineFIN_CRC64(crc)((crc).crc0 ^= UINT64CONST(0xffffffffffffffff))
128-
129-
/* Accumulate some (more) bytes into a CRC */
130-
#defineCOMP_CRC64(crc,data,len)\
131-
do { \
132-
uint64__crc0 = (crc).crc0; \
133-
unsigned char *__data = (unsigned char *) (data); \
134-
uint32__len = (len); \
135-
\
136-
while (__len-- > 0) \
137-
{ \
138-
int__tab_index = ((int) (__crc0 >> 56) ^ *__data++) & 0xFF; \
139-
__crc0 = pg_crc64_table[__tab_index] ^ (__crc0 << 8); \
140-
} \
141-
(crc).crc0 = __crc0; \
142-
} while (0)
143-
144-
/* Check for equality of two CRCs */
145-
#defineEQ_CRC64(c1,c2) ((c1).crc0 == (c2).crc0)
146-
147-
/* Constant table for CRC calculation */
148-
externCRCDLLIMPORTconstuint64pg_crc64_table[];
149-
#endif/* SIZEOF_VOID_P < 8 */
150-
#endif/* PROVIDE_64BIT_CRC */
151-
15256
#endif/* PG_CRC_H */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp