diff crc32c.c @ 3:6483683ac857 default tip

*: add profiling code too; expand x86 to use all eight XMM registers basically ported verbatim from the assembly
author Paper <paper@tflc.us>
date Mon, 09 Feb 2026 21:30:30 -0500
parents 422835bc1aca
children
line wrap: on
line diff
--- a/crc32c.c	Mon Feb 09 01:21:00 2026 -0500
+++ b/crc32c.c	Mon Feb 09 21:30:30 2026 -0500
@@ -2,10 +2,8 @@
 
 uint32_t crc32c_r(uint32_t crc, const unsigned char *message, size_t sz)
 {
-	size_t i;
-
-	for (i = 0; i < sz; i++)
-		crc = (crc >> 8) ^ crc32_tab[(crc ^ message[i]) & 0xFF];
+	while (sz--)
+		crc = (crc >> 8) ^ crc32_tab[(crc ^ *message++) & 0xFF];
 
 	return crc;
 }