--- /dev/null
+/* gvmat32.c -- C portion of the optimized longest_match for 32 bits x86\r
+ * Copyright (C) 1995-1996 Jean-loup Gailly and Gilles Vollant.\r
+ * File written by Gilles Vollant, by modifiying the longest_match\r
+ * from Jean-loup Gailly in deflate.c\r
+ * it prepare all parameters and call the assembly longest_match_gvasm\r
+ * longest_match execute standard C code is wmask != 0x7fff\r
+ * (assembly code is faster with a fixed wmask)\r
+ *\r
+ * Read comment at beginning of gvmat32.asm for more information\r
+ */\r
+\r
+#if defined(ASMV) && (!defined(NOOLDPENTIUMCODE))\r
+#include "deflate.h"\r
+\r
+/* if your C compiler don't add underline before function name,\r
+ define ADD_UNDERLINE_ASMFUNC */\r
+#ifdef ADD_UNDERLINE_ASMFUNC\r
+#define longest_match_7fff _longest_match_7fff\r
+#define longest_match_686 _longest_match_686\r
+#define cpudetect32 _cpudetect32\r
+#endif\r
+\r
+\r
+unsigned long cpudetect32();\r
+\r
+uInt longest_match_c(\r
+ deflate_state *s,\r
+ IPos cur_match); /* current match */\r
+\r
+\r
+uInt longest_match_7fff(\r
+ deflate_state *s,\r
+ IPos cur_match); /* current match */\r
+\r
+uInt longest_match_686(\r
+ deflate_state *s,\r
+ IPos cur_match); /* current match */\r
+\r
+\r
+static uInt iIsPPro=2;\r
+\r
+void match_init ()\r
+{\r
+ iIsPPro = (((cpudetect32()/0x100)&0xf)>=6) ? 1 : 0;\r
+}\r
+\r
+uInt longest_match(\r
+ deflate_state *s,\r
+ IPos cur_match) /* current match */\r
+{\r
+ if (iIsPPro!=0)\r
+ return longest_match_686(s,cur_match);\r
+\r
+ if (s->w_mask != 0x7fff)\r
+ return longest_match_686(s,cur_match);\r
+\r
+ /* now ((s->w_mask == 0x7fff) && (iIsPPro==0)) */\r
+ return longest_match_7fff(s,cur_match);\r
+}\r
+\r
+\r
+#endif /* defined(ASMV) && (!defined(NOOLDPENTIUMCODE)) */\r