1 /* crc32_fold.h -- crc32 folding interface 2 * Copyright (C) 2021 Nathan Moinvaziri 3 * For conditions of distribution and use, see copyright notice in zlib.h 4 */ 5 #ifndef CRC32_FOLD_H_ 6 #define CRC32_FOLD_H_ 7 8 #define CRC32_FOLD_BUFFER_SIZE (16 * 5) 9 /* sizeof(__m128i) * (4 folds & 1 partial fold) */ 10 11 typedef struct crc32_fold_s { 12 uint8_t fold[CRC32_FOLD_BUFFER_SIZE]; 13 uint32_t value; 14 } crc32_fold; 15 16 Z_INTERNAL uint32_t crc32_fold_reset_c(crc32_fold *crc); 17 Z_INTERNAL void crc32_fold_copy_c(crc32_fold *crc, uint8_t *dst, const uint8_t *src, size_t len); 18 Z_INTERNAL void crc32_fold_c(crc32_fold *crc, const uint8_t *src, size_t len, uint32_t init_crc); 19 Z_INTERNAL uint32_t crc32_fold_final_c(crc32_fold *crc); 20 21 #endif 22