summaryrefslogtreecommitdiffstats
path: root/third_party/zlib/contrib/masmx86/gvmat32c.c
diff options
context:
space:
mode:
authorIra Cooper <ira@samba.org>2014-07-22 21:26:40 -0700
committerIra Cooper <ira@samba.org>2014-08-09 18:26:16 +0200
commite8e85689756eaf74e82f55b8ae6f706b430b01cd (patch)
treed4d39094f46bb834683649d0aad3d9a0e785e55c /third_party/zlib/contrib/masmx86/gvmat32c.c
parentea3d62eea980348e73d6eeb870f36d0908ab42c3 (diff)
downloadsamba-e8e85689756eaf74e82f55b8ae6f706b430b01cd.tar.gz
samba-e8e85689756eaf74e82f55b8ae6f706b430b01cd.tar.xz
samba-e8e85689756eaf74e82f55b8ae6f706b430b01cd.zip
third_party/zlib: Initial copy of zlib.
Signed-off-by: Ira Cooper <ira@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'third_party/zlib/contrib/masmx86/gvmat32c.c')
-rw-r--r--third_party/zlib/contrib/masmx86/gvmat32c.c62
1 files changed, 62 insertions, 0 deletions
diff --git a/third_party/zlib/contrib/masmx86/gvmat32c.c b/third_party/zlib/contrib/masmx86/gvmat32c.c
new file mode 100644
index 0000000000..7ad2b27943
--- /dev/null
+++ b/third_party/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)) */