1 /* functable.h -- Struct containing function pointers to optimized functions
2  * Copyright (C) 2017 Hans Kristian Rosbach
3  * For conditions of distribution and use, see copyright notice in zlib.h
4  */
5 
6 #ifndef FUNCTABLE_H_
7 #define FUNCTABLE_H_
8 
9 #include "deflate.h"
10 #include "crc32_fold.h"
11 #include "adler32_fold.h"
12 
13 struct functable_s {
14     uint32_t (* adler32)            (uint32_t adler, const unsigned char *buf, size_t len);
15     uint32_t (* adler32_fold_copy)  (uint32_t adler, uint8_t *dst, const uint8_t *src, size_t len);
16     uint32_t (* crc32)              (uint32_t crc, const unsigned char *buf, uint64_t len);
17     uint32_t (* crc32_fold_reset)   (crc32_fold *crc);
18     void     (* crc32_fold_copy)    (crc32_fold *crc, uint8_t *dst, const uint8_t *src, size_t len);
19     void     (* crc32_fold)         (crc32_fold *crc, const uint8_t *src, size_t len, uint32_t init_crc);
20     uint32_t (* crc32_fold_final)   (crc32_fold *crc);
21     uint32_t (* compare256)         (const uint8_t *src0, const uint8_t *src1);
22     uint32_t (* chunksize)          (void);
23     uint8_t* (* chunkcopy)          (uint8_t *out, uint8_t const *from, unsigned len);
24     uint8_t* (* chunkunroll)        (uint8_t *out, unsigned *dist, unsigned *len);
25     uint8_t* (* chunkmemset)        (uint8_t *out, unsigned dist, unsigned len);
26     uint8_t* (* chunkmemset_safe)   (uint8_t *out, unsigned dist, unsigned len, unsigned left);
27     void     (* insert_string)      (deflate_state *const s, uint32_t str, uint32_t count);
28     uint32_t (* longest_match)      (deflate_state *const s, Pos cur_match);
29     uint32_t (* longest_match_slow) (deflate_state *const s, Pos cur_match);
30     Pos      (* quick_insert_string)(deflate_state *const s, uint32_t str);
31     void     (* slide_hash)         (deflate_state *s);
32     uint32_t (* update_hash)        (deflate_state *const s, uint32_t h, uint32_t val);
33 };
34 
35 Z_INTERNAL extern Z_TLS struct functable_s functable;
36 
37 #endif
38