• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* crc32_simd.h
2  *
3  * Copyright 2017 The Chromium Authors
4  * Use of this source code is governed by a BSD-style license that can be
5  * found in the Chromium source repository LICENSE file.
6  */
7 
8 #include <stdint.h>
9 
10 #include "zconf.h"
11 #include "zutil.h"
12 #include "deflate.h"
13 
14 /*
15  * crc32_sse42_simd_(): compute the crc32 of the buffer, where the buffer
16  * length must be at least 64, and a multiple of 16.
17  */
18 uint32_t ZLIB_INTERNAL crc32_sse42_simd_(const unsigned char* buf,
19                                          z_size_t len,
20                                          uint32_t crc);
21 
22 /*
23  * crc32_sse42_simd_ buffer size constraints: see the use in zlib/crc32.c
24  * for computing the crc32 of an arbitrary length buffer.
25  */
26 #define Z_CRC32_SSE42_MINIMUM_LENGTH 64
27 #define Z_CRC32_SSE42_CHUNKSIZE_MASK 15
28 
29 /*
30  * CRC32 checksums using ARMv8-a crypto instructions.
31  */
32 uint32_t ZLIB_INTERNAL armv8_crc32_little(const unsigned char* buf,
33                                           z_size_t len,
34                                           uint32_t crc);
35 
36 /* aarch64 specific code. */
37 #if defined(__aarch64__)
38 
39 /* 128 is the sweet spot at the time of coding (late 2020). */
40 #define Z_CRC32_PMULL_MINIMUM_LENGTH 128
41 #define Z_CRC32_PMULL_CHUNKSIZE_MASK 15
42 
43 /*
44  * CRC32 checksums using ARMv8-a PMULL instructions, where the buffer
45  * length must be at least 64, and a multiple of 16.
46  */
47 uint32_t ZLIB_INTERNAL armv8_crc32_pmull_little(const unsigned char* buf,
48                                                 z_size_t len,
49                                                 uint32_t crc);
50 
51 #endif
52