]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
cksum: check API better
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 19 Feb 2025 04:09:10 +0000 (20:09 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Wed, 19 Feb 2025 04:10:19 +0000 (20:10 -0800)
* src/cksum_avx2.c, src/cksum_avx512.c, src/cksum_pclmul.c:
* src/cksum_vmull.c:
Include cksum.h instead of copying its decls/includes by hand.
This is a better way to ensure consistency among defns and uses.

src/cksum_avx2.c
src/cksum_avx512.c
src/cksum_pclmul.c
src/cksum_vmull.c

index 7fbc83d5bb10253df8346f348276becb0632419b..b50a5de1a9e07577c145f231939959119c3e02b4 100644 (file)
 
 #include <config.h>
 
+#include "cksum.h"
+
 #include <stdio.h>
 #include <sys/types.h>
-#include <stdint.h>
 #include <x86intrin.h>
 #include "system.h"
 
 /* Number of bytes to read at once.  */
 #define BUFLEN (1 << 16)
 
-extern uint_fast32_t const crctab[8][256];
-
-extern bool
-cksum_avx2 (FILE *fp, uint_fast32_t *crc_out, uintmax_t *length_out);
-
 bool
 cksum_avx2 (FILE *fp, uint_fast32_t *crc_out, uintmax_t *length_out)
 {
index b2cef2824fb003b41d6fb014818e3b6fbcea6b67..e62c3e3ac11f6a274763c1ca25f091bee46d8e1e 100644 (file)
 
 #include <config.h>
 
-#include <stdio.h>
+#include "cksum.h"
+
 #include <sys/types.h>
-#include <stdint.h>
 #include <x86intrin.h>
 #include "system.h"
 
 /* Number of bytes to read at once.  */
 #define BUFLEN (1 << 16)
 
-extern uint_fast32_t const crctab[8][256];
-
-extern bool
-cksum_avx512 (FILE *fp, uint_fast32_t *crc_out, uintmax_t *length_out);
-
 bool
 cksum_avx512 (FILE *fp, uint_fast32_t *crc_out, uintmax_t *length_out)
 {
index 5806556b633008a03a73573b01345720abcfba1a..c47bb9f849c4cd21e5b857d2c012baeb3b2ca01e 100644 (file)
 
 #include <config.h>
 
+#include "cksum.h"
+
 #include <stdio.h>
 #include <sys/types.h>
-#include <stdint.h>
 #include <x86intrin.h>
 #include "system.h"
 
 /* Number of bytes to read at once.  */
 #define BUFLEN (1 << 16)
 
-extern uint_fast32_t const crctab[8][256];
-
-extern bool
-cksum_pclmul (FILE *fp, uint_fast32_t *crc_out, uintmax_t *length_out);
-
 /* Calculate CRC32 using PCLMULQDQ CPU instruction found in x86/x64 CPUs */
 
 bool
index 0ff81e225d719d55e8e82e8f2dd80b10d773b3e2..fb3b6dcdd4e8b13b91c0504a84b9fa42d80e7de3 100644 (file)
 
 #include <config.h>
 
+#include "cksum.h"
+
 #include <stdio.h>
 #include <sys/types.h>
-#include <stdint.h>
 #include <arm_neon.h>
 #include "system.h"
 
 /* Number of bytes to read at once.  */
 #define BUFLEN (1 << 16)
 
-extern uint_fast32_t const crctab[8][256];
-
-extern bool
-cksum_vmull (FILE *fp, uint_fast32_t *crc_out, uintmax_t *length_out);
-
 static uint64x2_t
 bswap_neon (uint64x2_t in)
 {
@@ -92,7 +88,6 @@ cksum_vmull (FILE *fp, uint_fast32_t *crc_out, uintmax_t *length_out)
           data = bswap_neon (data);
           /* XOR in initial CRC value (for us 0 so no effect), or CRC value
              calculated for previous BUFLEN buffer from fread */
-
           uint64_t wcrc = crc;
           xor_crc = vcombine_u64 (vcreate_u64 (0), vcreate_u64 (wcrc << 32));
           crc = 0;