Skip to content

Commit 27c7d66

Browse files
j-naylorCommitfest Bot
authored and
Commitfest Bot
committed
Add debug for CI XXX not for commit
1 parent 1517ef4 commit 27c7d66

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/port/pg_crc32c_sse42.c

+12-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121

2222
#include "port/pg_crc32c.h"
2323

24+
#define DEBUG_CRC /* XXX not for commit, or at least comment out */
25+
2426
pg_attribute_no_sanitize_alignment()
2527
pg_attribute_target("sse4.2")
2628
pg_crc32c
@@ -98,6 +100,9 @@ pg_comp_crc32c_avx512(pg_crc32c crc, const void *data, size_t length)
98100
pg_crc32c crc0 = crc;
99101
size_t len = length;
100102
const char *buf = data;
103+
#ifdef DEBUG_CRC
104+
const size_t orig_len PG_USED_FOR_ASSERTS_ONLY = len;
105+
#endif
101106

102107
/* Align on cacheline boundary. The threshold is somewhat arbitrary. */
103108
if (unlikely(len > 256))
@@ -156,7 +161,13 @@ pg_comp_crc32c_avx512(pg_crc32c crc, const void *data, size_t length)
156161
len = end - buf;
157162
}
158163

159-
return pg_comp_crc32c_sse42(crc0, buf, len);
164+
crc0 = pg_comp_crc32c_sse42(crc0, buf, len);
165+
166+
#ifdef DEBUG_CRC
167+
Assert(crc0 == pg_comp_crc32c_sse42(crc, data, orig_len));
168+
#endif
169+
170+
return crc0;
160171
}
161172

162173
#endif

0 commit comments

Comments
 (0)