summaryrefslogtreecommitdiff
path: root/source4/lib/zlib/contrib/masmx86/gvmat32c.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2008-07-29 20:01:23 +0000
committerStefan Metzmacher <metze@samba.org>2008-08-07 19:15:59 +0200
commit05235802f7ae8fb1df952d28629dea26af5f1436 (patch)
tree68000e8b17e2d5e590616d26d71dc6f26108ccfc /source4/lib/zlib/contrib/masmx86/gvmat32c.c
parent8275d511bc3ea79a14a4704b7d914222adc2d321 (diff)
downloadsamba-05235802f7ae8fb1df952d28629dea26af5f1436.tar.gz
samba-05235802f7ae8fb1df952d28629dea26af5f1436.tar.bz2
samba-05235802f7ae8fb1df952d28629dea26af5f1436.zip
import of zlib-1.2.3
We want to use zlib for the mszip ndr (de)compression later, we'll need to add some new functions to zlib. metze (This used to be commit 65c9e91a1bb24851a030a304d011558562cc50d6)
Diffstat (limited to 'source4/lib/zlib/contrib/masmx86/gvmat32c.c')
-rw-r--r--source4/lib/zlib/contrib/masmx86/gvmat32c.c62
1 files changed, 62 insertions, 0 deletions
diff --git a/source4/lib/zlib/contrib/masmx86/gvmat32c.c b/source4/lib/zlib/contrib/masmx86/gvmat32c.c
new file mode 100644
index 0000000000..7ad2b27943
--- /dev/null
+++ b/source4/lib/zlib/contrib/masmx86/gvmat32c.c
@@ -0,0 +1,62 @@
+/* gvmat32.c -- C portion of the optimized longest_match for 32 bits x86
+ * Copyright (C) 1995-1996 Jean-loup Gailly and Gilles Vollant.
+ * File written by Gilles Vollant, by modifiying the longest_match
+ * from Jean-loup Gailly in deflate.c
+ * it prepare all parameters and call the assembly longest_match_gvasm
+ * longest_match execute standard C code is wmask != 0x7fff
+ * (assembly code is faster with a fixed wmask)
+ *
+ * Read comment at beginning of gvmat32.asm for more information
+ */
+
+#if defined(ASMV) && (!defined(NOOLDPENTIUMCODE))
+#include "deflate.h"
+
+/* if your C compiler don't add underline before function name,
+ define ADD_UNDERLINE_ASMFUNC */
+#ifdef ADD_UNDERLINE_ASMFUNC
+#define longest_match_7fff _longest_match_7fff
+#define longest_match_686 _longest_match_686
+#define cpudetect32 _cpudetect32
+#endif
+
+
+unsigned long cpudetect32();
+
+uInt longest_match_c(
+ deflate_state *s,
+ IPos cur_match); /* current match */
+
+
+uInt longest_match_7fff(
+ deflate_state *s,
+ IPos cur_match); /* current match */
+
+uInt longest_match_686(
+ deflate_state *s,
+ IPos cur_match); /* current match */
+
+
+static uInt iIsPPro=2;
+
+void match_init ()
+{
+ iIsPPro = (((cpudetect32()/0x100)&0xf)>=6) ? 1 : 0;
+}
+
+uInt longest_match(
+ deflate_state *s,
+ IPos cur_match) /* current match */
+{
+ if (iIsPPro!=0)
+ return longest_match_686(s,cur_match);
+
+ if (s->w_mask != 0x7fff)
+ return longest_match_686(s,cur_match);
+
+ /* now ((s->w_mask == 0x7fff) && (iIsPPro==0)) */
+ return longest_match_7fff(s,cur_match);
+}
+
+
+#endif /* defined(ASMV) && (!defined(NOOLDPENTIUMCODE)) */