inftrees.c
insert_string.c
insert_string_roll.c
+ slide_hash.c
trees.c
uncompr.c
zutil.c
inftrees.o \
insert_string.o \
insert_string_roll.o \
+ slide_hash.o \
trees.o \
uncompr.o \
zutil.o \
inftrees.lo \
insert_string.lo \
insert_string_roll.lo \
+ slide_hash.lo \
trees.lo \
uncompr.lo \
zutil.lo \
memset((unsigned char *)s->head, 0, HASH_SIZE * sizeof(*s->head)); \
} while (0)
-/* ===========================================================================
- * Slide the hash table when sliding the window down (could be avoided with 32
- * bit values at the expense of memory usage). We slide even when level == 0 to
- * keep the hash table consistent if we switch back to level > 0 later.
- */
-static inline void slide_hash_c_chain(Pos *table, uint32_t entries, uint16_t wsize) {
-#ifdef NOT_TWEAK_COMPILER
- table += entries;
- do {
- unsigned m;
- m = *--table;
- *table = (Pos)(m >= wsize ? m-wsize : 0);
- /* If entries is not on any hash chain, prev[entries] is garbage but
- * its value will never be used.
- */
- } while (--entries);
-#else
- {
- /* As of I make this change, gcc (4.8.*) isn't able to vectorize
- * this hot loop using saturated-subtraction on x86-64 architecture.
- * To avoid this defect, we can change the loop such that
- * o. the pointer advance forward, and
- * o. demote the variable 'm' to be local to the loop, and
- * choose type "Pos" (instead of 'unsigned int') for the
- * variable to avoid unnecessary zero-extension.
- */
- unsigned int i;
- Pos *q = table;
- for (i = 0; i < entries; i++) {
- Pos m = *q;
- Pos t = (Pos)wsize;
- *q++ = (Pos)(m >= t ? m-t: 0);
- }
- }
-#endif /* NOT_TWEAK_COMPILER */
-}
-
-Z_INTERNAL void slide_hash_c(deflate_state *s) {
- unsigned int wsize = s->w_size;
-
- slide_hash_c_chain(s->head, HASH_SIZE, wsize);
- slide_hash_c_chain(s->prev, wsize, wsize);
- }
-
/* ========================================================================= */
int32_t Z_EXPORT PREFIX(deflateInit_)(PREFIX3(stream) *strm, int32_t level, const char *version, int32_t stream_size) {
return PREFIX(deflateInit2_)(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, version, stream_size);
--- /dev/null
+/* slide_hash.c -- slide hash table C implementation
+ *
+ * Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+#include "zbuild.h"
+#include "deflate.h"
+
+/* ===========================================================================
+ * Slide the hash table when sliding the window down (could be avoided with 32
+ * bit values at the expense of memory usage). We slide even when level == 0 to
+ * keep the hash table consistent if we switch back to level > 0 later.
+ */
+static inline void slide_hash_c_chain(Pos *table, uint32_t entries, uint16_t wsize) {
+#ifdef NOT_TWEAK_COMPILER
+ table += entries;
+ do {
+ unsigned m;
+ m = *--table;
+ *table = (Pos)(m >= wsize ? m-wsize : 0);
+ /* If entries is not on any hash chain, prev[entries] is garbage but
+ * its value will never be used.
+ */
+ } while (--entries);
+#else
+ {
+ /* As of I make this change, gcc (4.8.*) isn't able to vectorize
+ * this hot loop using saturated-subtraction on x86-64 architecture.
+ * To avoid this defect, we can change the loop such that
+ * o. the pointer advance forward, and
+ * o. demote the variable 'm' to be local to the loop, and
+ * choose type "Pos" (instead of 'unsigned int') for the
+ * variable to avoid unnecessary zero-extension.
+ */
+ unsigned int i;
+ Pos *q = table;
+ for (i = 0; i < entries; i++) {
+ Pos m = *q;
+ Pos t = (Pos)wsize;
+ *q++ = (Pos)(m >= t ? m-t: 0);
+ }
+ }
+#endif /* NOT_TWEAK_COMPILER */
+}
+
+Z_INTERNAL void slide_hash_c(deflate_state *s) {
+ unsigned int wsize = s->w_size;
+
+ slide_hash_c_chain(s->head, HASH_SIZE, wsize);
+ slide_hash_c_chain(s->prev, wsize, wsize);
+}
inffast.obj \
insert_string.obj \
insert_string_roll.obj \
+ slide_hash.obj \
trees.obj \
uncompr.obj \
zutil.obj \
inffast.obj: $(SRCDIR)/inffast.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/inftrees.h $(SRCDIR)/inflate.h $(SRCDIR)/inffast.h $(SRCDIR)/functable.h
inflate.obj: $(SRCDIR)/inflate.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/inftrees.h $(SRCDIR)/inflate.h $(SRCDIR)/inffast.h $(SRCDIR)/functable.h $(SRCDIR)/functable.h
inftrees.obj: $(SRCDIR)/inftrees.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/inftrees.h
+slide_hash.obj: $(SRCDIR)/slide_hash.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h
trees.obj: $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/trees_tbl.h
zutil.obj: $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/zutil_p.h
inffast.obj \
insert_string.obj \
insert_string_roll.obj \
+ slide_hash.obj \
trees.obj \
uncompr.obj \
zutil.obj \
inffast.obj: $(SRCDIR)/inffast.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/inftrees.h $(SRCDIR)/inflate.h $(SRCDIR)/inffast.h $(SRCDIR)/functable.h
inflate.obj: $(SRCDIR)/inflate.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/inftrees.h $(SRCDIR)/inflate.h $(SRCDIR)/inffast.h $(SRCDIR)/functable.h $(SRCDIR)/functable.h
inftrees.obj: $(SRCDIR)/inftrees.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/inftrees.h
+slide_hash.obj: $(SRCDIR)/slide_hash.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h
trees.obj: $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/trees_tbl.h
zutil.obj: $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/zutil_p.h
insert_string.obj \
insert_string_roll.obj \
insert_string_sse.obj \
+ slide_hash.obj \
slide_avx.obj \
slide_sse.obj \
trees.obj \
inffast.obj: $(SRCDIR)/inffast.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/inftrees.h $(SRCDIR)/inflate.h $(SRCDIR)/inffast.h $(SRCDIR)/functable.h
inflate.obj: $(SRCDIR)/inflate.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/inftrees.h $(SRCDIR)/inflate.h $(SRCDIR)/inffast.h $(SRCDIR)/functable.h $(SRCDIR)/functable.h
inftrees.obj: $(SRCDIR)/inftrees.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/inftrees.h
+slide_hash.obj: $(SRCDIR)/slide_hash.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h
slide_sse.obj: $(SRCDIR)/arch/x86/slide_sse.c $(SRCDIR)/deflate.h
trees.obj: $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/trees_tbl.h
zutil.obj: $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/zutil_p.h