summaryrefslogtreecommitdiff
path: root/contrib/asm386/gvmat32c.c
diff options
context:
space:
mode:
authorMark Adler <madler@alumni.caltech.edu>2011-09-09 23:19:21 -0700
committerMark Adler <madler@alumni.caltech.edu>2011-09-09 23:19:21 -0700
commitb8c9ecb0765fc39423c07613d909c5193378bdfd (patch)
treec2a2964d00dcfee6c7426ffcdf8e8060727bc2bf /contrib/asm386/gvmat32c.c
parent6759211ad8a5006689216a86c3267bb503bfccc1 (diff)
downloadzlib-1.0.9.tar.gz
zlib-1.0.9.tar.bz2
zlib-1.0.9.zip
zlib 1.0.9v1.0.9
Diffstat (limited to 'contrib/asm386/gvmat32c.c')
-rw-r--r--contrib/asm386/gvmat32c.c63
1 files changed, 17 insertions, 46 deletions
diff --git a/contrib/asm386/gvmat32c.c b/contrib/asm386/gvmat32c.c
index 43d530b..d853bb7 100644
--- a/contrib/asm386/gvmat32c.c
+++ b/contrib/asm386/gvmat32c.c
@@ -7,7 +7,6 @@
7 * (assembly code is faster with a fixed wmask) 7 * (assembly code is faster with a fixed wmask)
8 * 8 *
9 */ 9 */
10//#pragma optimize("agt",on)
11 10
12#include "deflate.h" 11#include "deflate.h"
13 12
@@ -15,65 +14,31 @@
15#include <windows.h> 14#include <windows.h>
16 15
17#ifdef ASMV 16#ifdef ASMV
18
19#define NIL 0 17#define NIL 0
20 18
21static unsigned int tot=0;
22static unsigned int totl0=0;
23static unsigned int totl0p0=0;
24static unsigned int ba0=0;
25static unsigned int ba1=0;
26static unsigned int cpta=0;
27static unsigned int cptb=0;
28
29#define UNALIGNED_OK 19#define UNALIGNED_OK
30#define gvshow(a,b,c,d)
31/*
32void gvshow(int chain_length,int len,int limit,ushf* prev)
33{
34static int ival=0;
35char sz[80];
36unsigned long i;
37int prev0=*prev;
38 ival++;
39 //wsprintf(sz,"call %u, len=%u, chain_length=%u\n",ival,len,chain_length);
40 //OutputDebugString(sz);
41 tot++;
42 if (limit==NIL)
43 totl0++;
44 if ((limit==NIL) && (prev0==0))
45 totl0p0++;
46 for (i=limit+1;i<32768;i++)
47 {
48 ush va=*(prev+i);
49 if (ba0>4000000000)
50 {
51 ba0+=10;
52 }
53 ba0++;
54 if ((va>limit) || (va==0))
55 continue;
56 ba1++;
57 }
58}
59*/
60 20
61 21
62/* if your C compiler don't add underline before function name, 22/* if your C compiler don't add underline before function name,
63 define ADD_UNDERLINE_ASMFUNC */ 23 define ADD_UNDERLINE_ASMFUNC */
64#ifdef ADD_UNDERLINE_ASMFUNC 24#ifdef ADD_UNDERLINE_ASMFUNC
65#define longest_match_asm7fff _longest_match_asm7fff 25#define longest_match_7fff _longest_match_7fff
66#endif 26#endif
27
28
29
67void match_init() 30void match_init()
68{ 31{
69} 32}
70 33
34unsigned long cpudetect32();
35
71uInt longest_match_c( 36uInt longest_match_c(
72 deflate_state *s, 37 deflate_state *s,
73 IPos cur_match); /* current match */ 38 IPos cur_match); /* current match */
74 39
75 40
76uInt longest_match_asm7fff( 41uInt longest_match_7fff(
77 deflate_state *s, 42 deflate_state *s,
78 IPos cur_match); /* current match */ 43 IPos cur_match); /* current match */
79 44
@@ -81,9 +46,15 @@ uInt longest_match(
81 deflate_state *s, 46 deflate_state *s,
82 IPos cur_match) /* current match */ 47 IPos cur_match) /* current match */
83{ 48{
84 if (s->w_mask == 0x7fff) 49 static uInt iIsPPro=2;
85 return longest_match_asm7fff(s,cur_match); 50
86 return longest_match_c(s,cur_match); 51 if ((s->w_mask == 0x7fff) && (iIsPPro==0))
52 return longest_match_7fff(s,cur_match);
53
54 if (iIsPPro==2)
55 iIsPPro = (((cpudetect32()/0x100)&0xf)>=6) ? 1 : 0;
56
57 return longest_match_c(s,cur_match);
87} 58}
88 59
89 60
@@ -222,7 +193,7 @@ uInt longest_match_c(s, cur_match)
222 } while ((cur_match = prev[cur_match & wmask]) > limit 193 } while ((cur_match = prev[cur_match & wmask]) > limit
223 && --chain_length != 0); 194 && --chain_length != 0);
224 195
225 if ((uInt)best_len <= s->lookahead) return best_len; 196 if ((uInt)best_len <= s->lookahead) return (uInt)best_len;
226 return s->lookahead; 197 return s->lookahead;
227} 198}
228 199