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.38 by root, Sun May 30 05:46:56 2010 UTC vs.
Revision 1.41 by root, Tue Jun 1 02:30:06 2010 UTC

1/* 1/*
2 * Copyright (c) 2000-2009 Marc Alexander Lehmann <schmorp@schmorp.de> 2 * Copyright (c) 2000-2010 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,
38 38
39#define HSIZE (1 << (HLOG)) 39#define HSIZE (1 << (HLOG))
40 40
41/* 41/*
42 * don't play with this unless you benchmark! 42 * don't play with this unless you benchmark!
43 * decompression is not dependent on the hash function 43 * the data format is not dependent on the hash function.
44 * the hashing function might seem strange, just believe me 44 * the hash function might seem strange, just believe me,
45 * it works ;) 45 * it works ;)
46 */ 46 */
47#ifndef FRST 47#ifndef FRST
48# define FRST(p) (((p[0]) << 8) | p[1]) 48# define FRST(p) (((p[0]) << 8) | p[1])
49# define NEXT(v,p) (((v) << 8) | p[2]) 49# define NEXT(v,p) (((v) << 8) | p[2])
153 && ref < ip /* the next test will actually take care of this, but this is faster */ 153 && ref < ip /* the next test will actually take care of this, but this is faster */
154#endif 154#endif
155 && (off = ip - ref - 1) < MAX_OFF 155 && (off = ip - ref - 1) < MAX_OFF
156 && ip + 4 < in_end 156 && ip + 4 < in_end
157 && ref > (u8 *)in_data 157 && ref > (u8 *)in_data
158 && ref[2] == ip[2]
158#if STRICT_ALIGN 159#if STRICT_ALIGN
159 && ref[0] == ip[0] 160 && (ref[1] << 8) | ref[0] == (ip[1] << 8) | ip[0]
160 && ref[1] == ip[1]
161 && ref[2] == ip[2]
162#else 161#else
163 && *(u16 *)ref == *(u16 *)ip 162 && *(u16 *)ref == *(u16 *)ip
164 && ref[2] == ip[2]
165#endif 163#endif
166 ) 164 )
167 { 165 {
168 /* match found at *ref++ */ 166 /* match found at *ref++ */
169 unsigned int len = 2; 167 unsigned int len = 2;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines