1 /* chunkset.c -- inline functions to copy small data chunks.
2 * For conditions of distribution and use, see copyright notice in zlib.h
3 */
4
5 #include "zbuild.h"
6
7 typedef uint64_t chunk_t;
8
9 #define CHUNK_SIZE 8
10
11 #define HAVE_CHUNKMEMSET_4
12 #define HAVE_CHUNKMEMSET_8
13
chunkmemset_4(uint8_t * from,chunk_t * chunk)14 static inline void chunkmemset_4(uint8_t *from, chunk_t *chunk) {
15 uint8_t *dest = (uint8_t *)chunk;
16 zmemcpy_4(dest, from);
17 zmemcpy_4(dest+4, from);
18 }
19
chunkmemset_8(uint8_t * from,chunk_t * chunk)20 static inline void chunkmemset_8(uint8_t *from, chunk_t *chunk) {
21 zmemcpy_8(chunk, from);
22 }
23
loadchunk(uint8_t const * s,chunk_t * chunk)24 static inline void loadchunk(uint8_t const *s, chunk_t *chunk) {
25 zmemcpy_8(chunk, (uint8_t *)s);
26 }
27
storechunk(uint8_t * out,chunk_t * chunk)28 static inline void storechunk(uint8_t *out, chunk_t *chunk) {
29 zmemcpy_8(out, chunk);
30 }
31
32 #define CHUNKSIZE chunksize_c
33 #define CHUNKCOPY chunkcopy_c
34 #define CHUNKCOPY_SAFE chunkcopy_safe_c
35 #define CHUNKUNROLL chunkunroll_c
36 #define CHUNKMEMSET chunkmemset_c
37 #define CHUNKMEMSET_SAFE chunkmemset_safe_c
38
39 #include "chunkset_tpl.h"
40