code: plan9front

Download patch

ref: 79a7b4ae59c2e0352b354cf719bc7ef4055f83ae
parent: 7359de438cfaac829c4ed8b39fae9bb872fb5eea
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Fri Feb 16 21:22:46 EST 2024

ext4srv: ext4_crc32c: use u32int macro

--- a/sys/src/cmd/ext4srv/ext4_crc32.c
+++ b/sys/src/cmd/ext4srv/ext4_crc32.c
@@ -135,7 +135,7 @@
 
 u32int ext4_crc32c(u32int crc, const void *buf, u32int size)
 {
-	const u8int *p = (const u8int *)buf;
+	const u8int *p = buf;
 	while(size > 0 && ((uintptr)p & 3) != 0){
 		size--;
 		crc = crc32c_tab[0][(crc ^ *p++) & 0xFF] ^ (crc >> 8);
@@ -144,12 +144,8 @@
 	const u32int *p32 = (const u32int *)p;
 	while(size >= 4){
 		size -= 4;
-		crc ^= *p32++;
-		crc =
-			crc32c_tab[0][crc>>24] ^
-			crc32c_tab[1][(crc>>16) & 0xff] ^
-			crc32c_tab[2][(crc>>8) & 0xff] ^
-			crc32c_tab[3][crc & 0xff];
+		crc = ext4_crc32_u(crc, *p32);
+		p32++;
 	}
 
 	p = (const u8int *)p32;