55 " deflate 1.3 Copyright 1995-2023 Jean-loup Gailly and Mark Adler ";
96 #define ACTUAL_MIN_MATCH 4
130 #define RANK(f) (((f) * 2) - ((f) > 4 ? 9 : 0))
134 #include <arm_neon.h>
135 #include <arm_acle.h>
140 #elif defined __x86_64__ || defined _M_AMD64
142 #include <immintrin.h>
149 #error "Only 64-bit Intel and ARM architectures are supported"
169 for (idx = 0; idx <
count; idx++) {
179 #define CLEAR_HASH(s) \
180 zmemzero((uint8_t *)s->head, (unsigned)(s->hash_size)*sizeof(*s->head));
192 int windowBits,
int memLevel,
int strategy,
193 const char *
version,
int stream_size) {
222 if (windowBits < 0) {
224 if (windowBits < -15)
226 windowBits = -windowBits;
228 else if (windowBits > 15) {
233 windowBits < 8 || windowBits > 15 || level < 0 || level > 9 ||
234 strategy < 0 || strategy >
Z_FIXED || (windowBits == 8 && wrap != 1)) {
237 if (windowBits == 8) windowBits = 9;
367 if (dictLength >= s->
w_size) {
374 dictionary += dictLength - s->
w_size;
494 if (level < 0 || level > 9 || strategy < 0 || strategy >
Z_FIXED) {
521 int nice_length,
int max_chain) {
557 complen = sourceLen +
558 ((sourceLen + 7) >> 3) + ((sourceLen + 63) >> 6) + 5;
571 wraplen = 6 + (s->
strstart ? 4 : 0);
598 return complen + wraplen;
601 return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) +
602 (sourceLen >> 25) + 13 - 6 + wraplen;
629 if (
len == 0)
return;
715 else if (s->
level < 6)
717 else if (s->
level == 6)
721 header |= (level_flags << 6);
723 header += 31 - (header % 31);
1029 if (
len == 0)
return 0;
1187 if ((cur_match =
prev[cur_match & wmask]) > limit
1188 && --chain_length != 0) {
1199 scan += 4,
match+=4;
1205 int match_byte = __builtin_ctzl(xor) / 8;
1207 match += match_byte;
1213 }
while (scan < strend);
1223 if (
len > best_len) {
1227 scan_end = *(
uint32_t*)(scan+best_len-3);
1229 }
while ((cur_match =
prev[cur_match & wmask]) > limit
1230 && --chain_length != 0);
1248 fprintf(stderr,
" start %u, match %u, length %d\n",
1249 start,
match, length);
1252 }
while (--length != 0);
1253 z_error(
"invalid match");
1255 if (z_verbose > 1) {
1256 fprintf(stderr,
"\\[%d,%d]", start -
match, length);
1257 do { putc(s->
window[start++], stderr); }
while (--length != 0);
1261 # define check_match(s, start, match, length)
1286 if (
sizeof(
int) <= 2) {
1290 }
else if (more == (
unsigned)(-1)) {
1315 W = vmovq_n_u16(wsize);
1318 for(
i=0;
i<
n/8;
i++) {
1319 vst1q_u16(q, vqsubq_u16(vld1q_u16(q),
W));
1326 for(
i=0;
i<
n/8;
i++) {
1327 vst1q_u16(q, vqsubq_u16(vld1q_u16(q),
W));
1331 #elif defined __x86_64__ || defined _M_AMD64
1338 for(
i=0;
i<
n/8;
i++) {
1346 for(
i=0;
i<
n/8;
i++) {
1367 Assert(more >= 2,
"more < 2");
1428 "not enough room for search");
1435 #define FLUSH_BLOCK_ONLY(s, last) { \
1436 _tr_flush_block(s, (s->block_start >= 0L ? \
1437 (uint8_t *)&s->window[(uint64_t)s->block_start] : \
1438 (uint8_t *)Z_NULL), \
1439 (uint64_t)((int64_t)s->strstart - s->block_start), \
1441 s->block_start = s->strstart; \
1442 flush_pending(s->strm); \
1443 Tracev((stderr,"[FLUSH]")); \
1447 #define FLUSH_BLOCK(s, last) { \
1448 FLUSH_BLOCK_ONLY(s, last); \
1449 if (s->strm->avail_out == 0) return (last) ? finish_started : need_more; \
1685 insert_cnt = mov_fwd;
1687 insert_cnt = max_insert - s->
strstart;
1764 if (
prev == *++scan &&
prev == *++scan &&
prev == *++scan) {
1767 }
while (
prev == *++scan &&
prev == *++scan &&
1768 prev == *++scan &&
prev == *++scan &&
1769 prev == *++scan &&
prev == *++scan &&
1770 prev == *++scan &&
prev == *++scan &&
static void DLIST_NAME() init(DLIST_LIST_TYPE *list)
static DLIST_TYPE *DLIST_NAME() prev(DLIST_LIST_TYPE *list, DLIST_TYPE *item)
static DLIST_TYPE *DLIST_NAME() next(DLIST_LIST_TYPE *list, DLIST_TYPE *item)
static const char * str(char *buf, int n)
strategy
Block allocation strategies.
unsigned int
A callback function used to compare two keys in a database.
if(yy_accept[yy_current_state])
const string version
version string
const struct ncbi::grid::netcache::search::fields::SIZE size
const GenericPointer< typename T::ValueType > T2 value
const CharType(& source)[N]
static int match(PCRE2_SPTR start_eptr, PCRE2_SPTR start_ecode, uint16_t top_bracket, PCRE2_SIZE frame_size, pcre2_match_data *match_data, match_block *mb)
static __m128i _mm_subs_epu16(__m128i a, __m128i b)
static uint32_t _mm_crc32_u32(uint32_t crc, uint32_t v)
static __m128i _mm_set1_epi16(short w)
static __m128i _mm_loadu_si128(const __m128i *p)
static void _mm_storeu_si128(__m128i *p, __m128i a)
struct tree_desc_s l_desc
struct ct_data_s dyn_dtree[2 *30+1]
struct ct_data_s bl_tree[2 *19+1]
struct tree_desc_s bl_desc
struct tree_desc_s d_desc
struct ct_data_s dyn_ltree[(2 *(256+1+29)+1)]
struct internal_state * state
const config configuration_table[10]
int ZEXPORT deflateSetHeader(z_streamp strm, gz_headerp head)
block_state deflate_fast(deflate_state *s, int flush)
int ZEXPORT deflateInit_(z_streamp strm, int level, const char *version, int stream_size)
void lm_init(deflate_state *s)
int ZEXPORT deflatePending(z_streamp strm, unsigned *pending, int *bits)
void putShortMSB(deflate_state *s, uInt b)
int ZEXPORT deflateCopy(z_streamp dest, z_streamp source)
int ZEXPORT deflateSetDictionary(z_streamp strm, const Bytef *dictionary, uInt dictLength)
int ZEXPORT deflateReset(z_streamp strm)
int ZEXPORT deflateParams(z_streamp strm, int level, int strategy)
block_state deflate_stored(deflate_state *s, int flush)
uLong ZEXPORT deflateBound(z_streamp strm, uLong sourceLen)
unsigned read_buf(z_streamp strm, Bytef *buf, unsigned size)
const char deflate_copyright[]
void fill_window(deflate_state *s)
block_state deflate_rle(deflate_state *s, int flush)
int deflateStateCheck(z_streamp strm)
int ZEXPORT deflateTune(z_streamp strm, int good_length, int max_lazy, int nice_length, int max_chain)
uInt longest_match(deflate_state *s, IPos cur_match)
block_state deflate_huff(deflate_state *s, int flush)
int ZEXPORT deflatePrime(z_streamp strm, int bits, int value)
block_state deflate_slow(deflate_state *s, int flush)
void flush_pending(z_streamp strm)
int ZEXPORT deflateResetKeep(z_streamp strm)
int ZEXPORT deflateEnd(z_streamp strm)
int ZEXPORT deflateInit2_(z_streamp strm, int level, int method, int windowBits, int memLevel, int strategy, const char *version, int stream_size)
int ZEXPORT deflate(z_streamp strm, int flush)
#define _tr_tally_dist(s, distance, length, flush)
#define _tr_tally_lit(s, c, flush)
#define Z_DEFAULT_STRATEGY
#define Z_DEFAULT_COMPRESSION
#define FLUSH_BLOCK_ONLY(s, last)
static void bulk_insert_str(deflate_state *s, Pos startpos, uint32_t count)
#define check_match(s, start, match, length)
static Pos insert_string(deflate_state *s, Pos str)
block_state(* compress_func)(deflate_state *s, int flush)
#define FLUSH_BLOCK(s, last)
#define ERR_RETURN(strm, err)
#define ZALLOC(strm, items, size)
#define Assert(cond, msg)
#define ZFREE(strm, addr)