this patch adds support for bzr in include/download.mk, and fixes
[openwrt.git] / package / compcache / patches / 001-lzo-speed.patch
1 diff -uNr compcache-0.5.3-org/sub-projects/compression/lzo-kmod/lzo1x_compress.c compcache-0.5.3/sub-projects/compression/lzo-kmod/lzo1x_compress.c
2 --- compcache-0.5.3-org/sub-projects/compression/lzo-kmod/lzo1x_compress.c 2009-04-20 06:28:30.000000000 +0200
3 +++ compcache-0.5.3/sub-projects/compression/lzo-kmod/lzo1x_compress.c 2009-04-20 06:29:21.000000000 +0200
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.3-org/sub-projects/compression/lzo-kmod/lzo1x_decompress.c compcache-0.5.3/sub-projects/compression/lzo-kmod/lzo1x_decompress.c
59 --- compcache-0.5.3-org/sub-projects/compression/lzo-kmod/lzo1x_decompress.c 2009-04-20 06:28:30.000000000 +0200
60 +++ compcache-0.5.3/sub-projects/compression/lzo-kmod/lzo1x_decompress.c 2009-04-20 06:29:21.000000000 +0200
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,30 +68,27 @@
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 }
112 }
113
114 -first_literal_run:
115 +//first_literal_run:
116 t = *ip++;
117 if (t >= 16)
118 goto match;
119 @@ -139,8 +133,7 @@
120 t += 31 + *ip++;
121 }
122 m_pos = op - 1;
123 - m_pos -= le16_to_cpu(get_unaligned(
124 - (const unsigned short *)ip)) >> 2;
125 + m_pos -= get_unaligned_le16(ip) >> 2;
126 ip += 2;
127 } else if (t >= 16) {
128 m_pos = op;
129 @@ -158,8 +151,7 @@
130 }
131 t += 7 + *ip++;
132 }
133 - m_pos -= le16_to_cpu(get_unaligned(
134 - (const unsigned short *)ip)) >> 2;
135 + m_pos -= get_unaligned_le16(ip) >> 2;
136 ip += 2;
137 if (m_pos == op)
138 goto eof_found;
139 @@ -184,21 +176,33 @@
140 if (HAVE_OP(t + 3 - 1, op_end, op))
141 goto output_overrun;
142
143 - if (t >= 2 * 4 - (3 - 1) && (op - m_pos) >= 4) {
144 - COPY4(op, m_pos);
145 - op += 4;
146 - m_pos += 4;
147 - t -= 4 - (3 - 1);
148 - do {
149 + if (t >= 2 * 4 - (3 - 1)) {
150 + /*
151 + * Assume memcpy don't copy
152 + * more than 32 bytes at once
153 + */
154 + if ((op - m_pos) >= 32) {
155 + t += (3 - 1);
156 + memcpy(op, m_pos, t);
157 + op += t;
158 + m_pos += t;
159 + } else if ((op - m_pos) >= 4) {
160 COPY4(op, m_pos);
161 op += 4;
162 m_pos += 4;
163 - t -= 4;
164 - } while (t >= 4);
165 - if (t > 0)
166 + t -= 4 - (3 - 1);
167 do {
168 - *op++ = *m_pos++;
169 - } while (--t > 0);
170 + COPY4(op, m_pos);
171 + op += 4;
172 + m_pos += 4;
173 + t -= 4;
174 + } while (t >= 4);
175 + if (t > 0)
176 + do {
177 + *op++ = *m_pos++;
178 + } while (--t > 0);
179 + } else
180 + goto copy_match;
181 } else {
182 copy_match:
183 *op++ = *m_pos++;
This page took 0.053478 seconds and 5 git commands to generate.