v16-0002-Add-debug-for-CI-XXX-not-for-commit.patch
application/x-patch
Filename: v16-0002-Add-debug-for-CI-XXX-not-for-commit.patch
Type: application/x-patch
Part: 1
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: format-patch
Series: patch v16-0002
Subject: Add debug for CI XXX not for commit
| File | + | − |
|---|---|---|
| src/port/pg_crc32c_sse42.c | 12 | 1 |
From 2254421337665b2b31e36d8aa85c336e2db25901 Mon Sep 17 00:00:00 2001
From: John Naylor <john.naylor@postgresql.org>
Date: Tue, 25 Mar 2025 15:19:16 +0700
Subject: [PATCH v16 2/2] Add debug for CI XXX not for commit
---
src/port/pg_crc32c_sse42.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/src/port/pg_crc32c_sse42.c b/src/port/pg_crc32c_sse42.c
index 4d8dec004b1..e2b1246f01d 100644
--- a/src/port/pg_crc32c_sse42.c
+++ b/src/port/pg_crc32c_sse42.c
@@ -21,6 +21,8 @@
#include "port/pg_crc32c.h"
+#define DEBUG_CRC /* XXX not for commit, or at least comment out */
+
pg_attribute_no_sanitize_alignment()
pg_attribute_target("sse4.2")
pg_crc32c
@@ -98,6 +100,9 @@ pg_comp_crc32c_avx512(pg_crc32c crc, const void *data, size_t length)
pg_crc32c crc0 = crc;
size_t len = length;
const char *buf = data;
+#ifdef DEBUG_CRC
+ const size_t orig_len PG_USED_FOR_ASSERTS_ONLY = len;
+#endif
/* Align on cacheline boundary. The threshold is somewhat arbitrary. */
if (unlikely(len > 256))
@@ -156,7 +161,13 @@ pg_comp_crc32c_avx512(pg_crc32c crc, const void *data, size_t length)
len = end - buf;
}
- return pg_comp_crc32c_sse42(crc0, buf, len);
+ crc0 = pg_comp_crc32c_sse42(crc0, buf, len);
+
+#ifdef DEBUG_CRC
+ Assert(crc0 == pg_comp_crc32c_sse42(crc, data, orig_len));
+#endif
+
+ return crc0;
}
#endif
--
2.48.1