[ar71xx] create firmware image for the WRT160NL board (thanks to Gerry Rozema)
[openwrt.git] / package / compcache / patches / 001-lzo-speed.patch
1 diff -uNr compcache-0.5/sub-projects/compression/lzo-kmod/lzo1x_compress.c compcache-0.5/sub-projects/compression/lzo-kmod/lzo1x_compress.c
2 --- compcache-0.5/sub-projects/compression/lzo-kmod/lzo1x_compress.c 2008-08-13 06:33:34.000000000 +0200
3 +++ compcache-0.5/sub-projects/compression/lzo-kmod/lzo1x_compress.c 2009-01-21 08:00:35.000000000 +0100
4 @@ -62,8 +62,12 @@
5 goto literal;
6
7 try_match:
8 +#ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
9 if (get_unaligned((const unsigned short *)m_pos)
10 == get_unaligned((const unsigned short *)ip)) {
11 +#else
12 + if (m_pos[0] == ip[0] && m_pos[1] == ip[1]) {
13 +#endif
14 if (likely(m_pos[2] == ip[2]))
15 goto match;
16 }
17 @@ -94,9 +98,14 @@
18 }
19 *op++ = tt;
20 }
21 - do {
22 - *op++ = *ii++;
23 - } while (--t > 0);
24 + if (t >= 2 * 4) {
25 + memcpy(op, ii, t);
26 + op += t;
27 + ii += t;
28 + } else
29 + do {
30 + *op++ = *ii++;
31 + } while (--t > 0);
32 }
33
34 ip += 3;
35 @@ -208,9 +217,14 @@
36
37 *op++ = tt;
38 }
39 - do {
40 - *op++ = *ii++;
41 - } while (--t > 0);
42 + if (t >= 2 * 4) {
43 + memcpy(op, ii, t);
44 + op += t;
45 + ii += t;
46 + } else
47 + do {
48 + *op++ = *ii++;
49 + } while (--t > 0);
50 }
51
52 *op++ = M4_MARKER | 1;
53 @@ -224,4 +238,3 @@
54
55 MODULE_LICENSE("GPL");
56 MODULE_DESCRIPTION("LZO1X-1 Compressor");
57 -
58 diff -uNr compcache-0.5/sub-projects/compression/lzo-kmod/lzo1x_decompress.c compcache-0.5/sub-projects/compression/lzo-kmod/lzo1x_decompress.c
59 --- compcache-0.5/sub-projects/compression/lzo-kmod/lzo1x_decompress.c 2008-08-13 06:33:42.000000000 +0200
60 +++ compcache-0.5/sub-projects/compression/lzo-kmod/lzo1x_decompress.c 2009-01-21 07:49:41.000000000 +0100
61 @@ -45,10 +45,7 @@
62 goto output_overrun;
63 if (HAVE_IP(t + 1, ip_end, ip))
64 goto input_overrun;
65 - do {
66 - *op++ = *ip++;
67 - } while (--t > 0);
68 - goto first_literal_run;
69 + goto prep_first_literal_run;
70 }
71
72 while ((ip < ip_end)) {
73 @@ -71,23 +68,20 @@
74 if (HAVE_IP(t + 4, ip_end, ip))
75 goto input_overrun;
76
77 - COPY4(op, ip);
78 - op += 4;
79 - ip += 4;
80 - if (--t > 0) {
81 - if (t >= 4) {
82 - do {
83 - COPY4(op, ip);
84 - op += 4;
85 - ip += 4;
86 - t -= 4;
87 - } while (t >= 4);
88 - if (t > 0) {
89 - do {
90 - *op++ = *ip++;
91 - } while (--t > 0);
92 - }
93 - } else {
94 + t += (4 - 1);
95 + if (t >= 2 * 4) {
96 + memcpy(op, ip, t);
97 + op += t;
98 + ip += t;
99 + } else {
100 + do {
101 + COPY4(op, ip);
102 + op += 4;
103 + ip += 4;
104 + t -= 4;
105 + } while (t >= 4);
106 + if (t > 0) {
107 +prep_first_literal_run:
108 do {
109 *op++ = *ip++;
110 } while (--t > 0);
111 @@ -139,8 +133,7 @@
112 t += 31 + *ip++;
113 }
114 m_pos = op - 1;
115 - m_pos -= le16_to_cpu(get_unaligned(
116 - (const unsigned short *)ip)) >> 2;
117 + m_pos -= get_unaligned_le16(ip) >> 2;
118 ip += 2;
119 } else if (t >= 16) {
120 m_pos = op;
121 @@ -158,8 +151,7 @@
122 }
123 t += 7 + *ip++;
124 }
125 - m_pos -= le16_to_cpu(get_unaligned(
126 - (const unsigned short *)ip)) >> 2;
127 + m_pos -= get_unaligned_le16(ip) >> 2;
128 ip += 2;
129 if (m_pos == op)
130 goto eof_found;
131 @@ -184,21 +176,33 @@
132 if (HAVE_OP(t + 3 - 1, op_end, op))
133 goto output_overrun;
134
135 - if (t >= 2 * 4 - (3 - 1) && (op - m_pos) >= 4) {
136 - COPY4(op, m_pos);
137 - op += 4;
138 - m_pos += 4;
139 - t -= 4 - (3 - 1);
140 - do {
141 + if (t >= 2 * 4 - (3 - 1)) {
142 + /*
143 + * Assume memcpy don't copy
144 + * more than 32 bytes at once
145 + */
146 + if ((op - m_pos) >= 32) {
147 + t += (3 - 1);
148 + memcpy(op, m_pos, t);
149 + op += t;
150 + m_pos += t;
151 + } else if ((op - m_pos) >= 4) {
152 COPY4(op, m_pos);
153 op += 4;
154 m_pos += 4;
155 - t -= 4;
156 - } while (t >= 4);
157 - if (t > 0)
158 + t -= 4 - (3 - 1);
159 do {
160 - *op++ = *m_pos++;
161 - } while (--t > 0);
162 + COPY4(op, m_pos);
163 + op += 4;
164 + m_pos += 4;
165 + t -= 4;
166 + } while (t >= 4);
167 + if (t > 0)
168 + do {
169 + *op++ = *m_pos++;
170 + } while (--t > 0);
171 + } else
172 + goto copy_match;
173 } else {
174 copy_match:
175 *op++ = *m_pos++;
176 @@ -247,9 +251,7 @@
177 *out_len = op - out;
178 return LZO_E_LOOKBEHIND_OVERRUN;
179 }
180 -
181 EXPORT_SYMBOL_GPL(lzo1x_decompress_safe);
182
183 MODULE_LICENSE("GPL");
184 MODULE_DESCRIPTION("LZO1X Decompressor");
185 -
This page took 0.050867 seconds and 5 git commands to generate.