ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/liblzf/lzf_c.c
(Generate patch)

Comparing liblzf/lzf_c.c (file contents):
Revision 1.32 by root, Fri May 9 12:42:50 2008 UTC vs.
Revision 1.34 by root, Sat Aug 30 06:32:20 2008 UTC

1/* 1/*
2 * Copyright (c) 2000-2007 Marc Alexander Lehmann <schmorp@schmorp.de> 2 * Copyright (c) 2000-2008 Marc Alexander Lehmann <schmorp@schmorp.de>
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without modifica- 4 * Redistribution and use in source and binary forms, with or without modifica-
5 * tion, are permitted provided that the following conditions are met: 5 * tion, are permitted provided that the following conditions are met:
6 * 6 *
7 * 1. Redistributions of source code must retain the above copyright notice, 7 * 1. Redistributions of source code must retain the above copyright notice,
206 while (len < maxlen && ref[len] == ip[len]); 206 while (len < maxlen && ref[len] == ip[len]);
207 207
208 break; 208 break;
209 } 209 }
210 210
211 len -= 2; 211 len -= 2; /* len is now #octets - 1 */
212 ip++; 212 ip++;
213 213
214 if (len < 7) 214 if (len < 7)
215 { 215 {
216 *op++ = (off >> 8) + (len << 5); 216 *op++ = (off >> 8) + (len << 5);
220 *op++ = (off >> 8) + ( 7 << 5); 220 *op++ = (off >> 8) + ( 7 << 5);
221 *op++ = len - 7; 221 *op++ = len - 7;
222 } 222 }
223 223
224 *op++ = off; 224 *op++ = off;
225 lit = 0; op++; /* start run */
226
227 ip += len + 1;
228
229 if (expect_false (ip > in_end - 2))
230 break;
225 231
226#if ULTRA_FAST || VERY_FAST 232#if ULTRA_FAST || VERY_FAST
227 ip += len;
228#if VERY_FAST && !ULTRA_FAST
229 --ip; 233 --ip;
234# if VERY_FAST && !ULTRA_FAST
235 --ip;
230#endif 236# endif
231 hval = FRST (ip); 237 hval = FRST (ip);
232 238
233 hval = NEXT (hval, ip); 239 hval = NEXT (hval, ip);
234 htab[IDX (hval)] = ip; 240 htab[IDX (hval)] = ip;
235 ip++; 241 ip++;
236 242
237#if VERY_FAST && !ULTRA_FAST 243# if VERY_FAST && !ULTRA_FAST
238 hval = NEXT (hval, ip); 244 hval = NEXT (hval, ip);
239 htab[IDX (hval)] = ip; 245 htab[IDX (hval)] = ip;
240 ip++; 246 ip++;
241#endif 247# endif
242#else 248#else
249 ip -= len + 1;
250
243 do 251 do
244 { 252 {
245 hval = NEXT (hval, ip); 253 hval = NEXT (hval, ip);
246 htab[IDX (hval)] = ip; 254 htab[IDX (hval)] = ip;
247 ip++; 255 ip++;
248 } 256 }
249 while (len--); 257 while (len--);
250#endif 258#endif
251
252 lit = 0; op++; /* start run */
253 } 259 }
254 else 260 else
255 { 261 {
256 /* one more literal byte we must copy */ 262 /* one more literal byte we must copy */
257 if (expect_false (op >= out_end)) 263 if (expect_false (op >= out_end))

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines