summaryrefslogtreecommitdiff
path: root/test/fuzz
diff options
context:
space:
mode:
authorNathan Moinvaziri <nathan@nathanm.com>2022-05-24 11:44:20 -0700
committerHans Kristian Rosbach <hk-github@circlestorm.org>2022-05-25 12:04:35 +0200
commita6155234a2aa34b4562570dbd359a2a505962a01 (patch)
treefffecc2105016a315c3da7d3d77caaf4d9ff05e4 /test/fuzz
parentd79984b5bcaccab15e6cd13d7d1edea32ac36977 (diff)
downloadProject-Tick-a6155234a2aa34b4562570dbd359a2a505962a01.tar.gz
Project-Tick-a6155234a2aa34b4562570dbd359a2a505962a01.zip
Speed up software CRC-32 computation by a factor of 1.5 to 3.
Use the interleaved method of Kadatch and Jenkins in order to make use of pipelined instructions through multiple ALUs in a single core. This also speeds up and simplifies the combination of CRCs, and updates the functions to pre-calculate and use an operator for CRC combination. Co-authored-by: Nathan Moinvaziri <nathan@nathanm.com>
Diffstat (limited to 'test/fuzz')
-rw-r--r--test/fuzz/fuzzer_checksum.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/test/fuzz/fuzzer_checksum.c b/test/fuzz/fuzzer_checksum.c
index e2002d5167..cedd284dbe 100644
--- a/test/fuzz/fuzzer_checksum.c
+++ b/test/fuzz/fuzzer_checksum.c
@@ -19,7 +19,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t dataLen) {
/* Checksum with a buffer of size equal to the first byte in the input. */
uint32_t buffSize = data[0];
uint32_t offset = 0;
- uint32_t op[32];
+ uint32_t op;
/* Discard inputs larger than 1Mb. */
static size_t kMaxSize = 1024 * 1024;
@@ -31,7 +31,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t dataLen) {
++buffSize;
/* CRC32 */
- PREFIX(crc32_combine_gen)(op, buffSize);
+ op = PREFIX(crc32_combine_gen)(buffSize);
for (offset = 0; offset + buffSize <= dataLen; offset += buffSize) {
uint32_t crc3 = PREFIX(crc32_z)(crc0, data + offset, buffSize);
uint32_t crc4 = PREFIX(crc32_combine_op)(crc1, crc3, op);
@@ -52,7 +52,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t dataLen) {
assert(combine1 == combine2);
/* Fast CRC32 combine. */
- PREFIX(crc32_combine_gen)(op, (z_off_t)dataLen);
+ op = PREFIX(crc32_combine_gen)((z_off_t)dataLen);
combine1 = PREFIX(crc32_combine_op)(crc1, crc2, op);
combine2 = PREFIX(crc32_combine_op)(crc2, crc1, op);
assert(combine1 == combine2);