1 |
loizides |
1.1 |
/* lzo_conf.h -- main internal configuration file for the the LZO library
|
2 |
|
|
|
3 |
|
|
This file is part of the LZO real-time data compression library.
|
4 |
|
|
|
5 |
|
|
Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer
|
6 |
|
|
Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer
|
7 |
|
|
Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer
|
8 |
|
|
Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer
|
9 |
|
|
Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer
|
10 |
|
|
Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer
|
11 |
|
|
Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer
|
12 |
|
|
Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer
|
13 |
|
|
Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer
|
14 |
|
|
Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer
|
15 |
|
|
Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer
|
16 |
|
|
Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer
|
17 |
|
|
Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer
|
18 |
|
|
All Rights Reserved.
|
19 |
|
|
|
20 |
|
|
The LZO library is free software; you can redistribute it and/or
|
21 |
|
|
modify it under the terms of the GNU General Public License as
|
22 |
|
|
published by the Free Software Foundation; either version 2 of
|
23 |
|
|
the License, or (at your option) any later version.
|
24 |
|
|
|
25 |
|
|
The LZO library is distributed in the hope that it will be useful,
|
26 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
27 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
28 |
|
|
GNU General Public License for more details.
|
29 |
|
|
|
30 |
|
|
You should have received a copy of the GNU General Public License
|
31 |
|
|
along with the LZO library; see the file COPYING.
|
32 |
|
|
If not, write to the Free Software Foundation, Inc.,
|
33 |
|
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
34 |
|
|
|
35 |
|
|
Markus F.X.J. Oberhumer
|
36 |
|
|
<markus@oberhumer.com>
|
37 |
|
|
http://www.oberhumer.com/opensource/lzo/
|
38 |
|
|
*/
|
39 |
|
|
|
40 |
|
|
|
41 |
|
|
/* WARNING: this file should *not* be used by applications. It is
|
42 |
|
|
part of the implementation of the library and is subject
|
43 |
|
|
to change.
|
44 |
|
|
*/
|
45 |
|
|
|
46 |
|
|
|
47 |
|
|
#ifndef __LZO_CONF_H
|
48 |
|
|
#define __LZO_CONF_H
|
49 |
|
|
|
50 |
|
|
#if !defined(__LZO_IN_MINILZO)
|
51 |
|
|
#if defined(LZO_CFG_FREESTANDING)
|
52 |
|
|
# define LZO_LIBC_FREESTANDING 1
|
53 |
|
|
# define LZO_OS_FREESTANDING 1
|
54 |
|
|
# define ACC_LIBC_FREESTANDING 1
|
55 |
|
|
# define ACC_OS_FREESTANDING 1
|
56 |
|
|
#endif
|
57 |
|
|
#if defined(LZO_CFG_NO_UNALIGNED)
|
58 |
|
|
# define ACC_CFG_NO_UNALIGNED 1
|
59 |
|
|
#endif
|
60 |
|
|
#if defined(LZO_ARCH_GENERIC)
|
61 |
|
|
# define ACC_ARCH_GENERIC 1
|
62 |
|
|
#endif
|
63 |
|
|
#if defined(LZO_ABI_NEUTRAL_ENDIAN)
|
64 |
|
|
# define ACC_ABI_NEUTRAL_ENDIAN 1
|
65 |
|
|
#endif
|
66 |
|
|
#if defined(LZO_HAVE_CONFIG_H)
|
67 |
|
|
# define ACC_CONFIG_NO_HEADER 1
|
68 |
|
|
#endif
|
69 |
|
|
#if defined(LZO_CFG_EXTRA_CONFIG_HEADER)
|
70 |
|
|
# include LZO_CFG_EXTRA_CONFIG_HEADER
|
71 |
|
|
#endif
|
72 |
|
|
#if defined(__LZOCONF_H) || defined(__LZOCONF_H_INCLUDED)
|
73 |
|
|
# error "include this file first"
|
74 |
|
|
#endif
|
75 |
|
|
#include "lzo/lzoconf.h"
|
76 |
|
|
#endif
|
77 |
|
|
|
78 |
|
|
#if (LZO_VERSION < 0x02000) || !defined(__LZOCONF_H_INCLUDED)
|
79 |
|
|
# error "version mismatch"
|
80 |
|
|
#endif
|
81 |
|
|
|
82 |
|
|
|
83 |
|
|
/***********************************************************************
|
84 |
|
|
// pragmas
|
85 |
|
|
************************************************************************/
|
86 |
|
|
|
87 |
|
|
#if (LZO_CC_BORLANDC && LZO_ARCH_I086)
|
88 |
|
|
# pragma option -h /* enable fast huge pointers */
|
89 |
|
|
#endif
|
90 |
|
|
|
91 |
|
|
#if (LZO_CC_MSC && (_MSC_VER >= 1000))
|
92 |
|
|
# pragma warning(disable: 4127 4701)
|
93 |
|
|
#endif
|
94 |
|
|
#if (LZO_CC_MSC && (_MSC_VER >= 1300))
|
95 |
|
|
/* avoid `-Wall' warnings in system header files */
|
96 |
|
|
# pragma warning(disable: 4820)
|
97 |
|
|
/* avoid warnings about inlining */
|
98 |
|
|
# pragma warning(disable: 4514 4710 4711)
|
99 |
|
|
#endif
|
100 |
|
|
|
101 |
|
|
#if (LZO_CC_SUNPROC)
|
102 |
|
|
# pragma error_messages(off,E_END_OF_LOOP_CODE_NOT_REACHED)
|
103 |
|
|
# pragma error_messages(off,E_LOOP_NOT_ENTERED_AT_TOP)
|
104 |
|
|
#endif
|
105 |
|
|
|
106 |
|
|
|
107 |
|
|
/***********************************************************************
|
108 |
|
|
//
|
109 |
|
|
************************************************************************/
|
110 |
|
|
|
111 |
|
|
#if defined(__LZO_MMODEL_HUGE) && (!LZO_HAVE_MM_HUGE_PTR)
|
112 |
|
|
# error "this should not happen - check defines for __huge"
|
113 |
|
|
#endif
|
114 |
|
|
|
115 |
|
|
#if defined(__LZO_IN_MINILZO) || defined(LZO_CFG_FREESTANDING)
|
116 |
|
|
#elif (LZO_OS_DOS16 || LZO_OS_OS216 || LZO_OS_WIN16)
|
117 |
|
|
# define ACC_WANT_ACC_INCD_H 1
|
118 |
|
|
# define ACC_WANT_ACC_INCE_H 1
|
119 |
|
|
# define ACC_WANT_ACC_INCI_H 1
|
120 |
|
|
#elif 1
|
121 |
|
|
# include <string.h>
|
122 |
|
|
#else
|
123 |
|
|
# define ACC_WANT_ACC_INCD_H 1
|
124 |
|
|
#endif
|
125 |
|
|
#include "miniacc.h"
|
126 |
|
|
|
127 |
|
|
|
128 |
|
|
#if defined(LZO_CFG_FREESTANDING)
|
129 |
|
|
# undef HAVE_MEMCMP
|
130 |
|
|
# undef HAVE_MEMCPY
|
131 |
|
|
# undef HAVE_MEMMOVE
|
132 |
|
|
# undef HAVE_MEMSET
|
133 |
|
|
#endif
|
134 |
|
|
|
135 |
|
|
#if !defined(HAVE_MEMCMP)
|
136 |
|
|
# undef memcmp
|
137 |
|
|
# define memcmp(a,b,c) lzo_memcmp(a,b,c)
|
138 |
|
|
#elif !defined(__LZO_MMODEL_HUGE)
|
139 |
|
|
# define lzo_memcmp(a,b,c) memcmp(a,b,c)
|
140 |
|
|
#endif
|
141 |
|
|
#if !defined(HAVE_MEMCPY)
|
142 |
|
|
# undef memcpy
|
143 |
|
|
# define memcpy(a,b,c) lzo_memcpy(a,b,c)
|
144 |
|
|
#elif !defined(__LZO_MMODEL_HUGE)
|
145 |
|
|
# define lzo_memcpy(a,b,c) memcpy(a,b,c)
|
146 |
|
|
#endif
|
147 |
|
|
#if !defined(HAVE_MEMMOVE)
|
148 |
|
|
# undef memmove
|
149 |
|
|
# define memmove(a,b,c) lzo_memmove(a,b,c)
|
150 |
|
|
#elif !defined(__LZO_MMODEL_HUGE)
|
151 |
|
|
# define lzo_memmove(a,b,c) memmove(a,b,c)
|
152 |
|
|
#endif
|
153 |
|
|
#if !defined(HAVE_MEMSET)
|
154 |
|
|
# undef memset
|
155 |
|
|
# define memset(a,b,c) lzo_memset(a,b,c)
|
156 |
|
|
#elif !defined(__LZO_MMODEL_HUGE)
|
157 |
|
|
# define lzo_memset(a,b,c) memset(a,b,c)
|
158 |
|
|
#endif
|
159 |
|
|
|
160 |
|
|
|
161 |
|
|
#undef NDEBUG
|
162 |
|
|
#if defined(LZO_CFG_FREESTANDING)
|
163 |
|
|
# undef LZO_DEBUG
|
164 |
|
|
# define NDEBUG 1
|
165 |
|
|
# undef assert
|
166 |
|
|
# define assert(e) ((void)0)
|
167 |
|
|
#else
|
168 |
|
|
# if !defined(LZO_DEBUG)
|
169 |
|
|
# define NDEBUG 1
|
170 |
|
|
# endif
|
171 |
|
|
# include <assert.h>
|
172 |
|
|
#endif
|
173 |
|
|
|
174 |
|
|
#if 0 && defined(__BOUNDS_CHECKING_ON)
|
175 |
|
|
# include <unchecked.h>
|
176 |
|
|
#else
|
177 |
|
|
# define BOUNDS_CHECKING_OFF_DURING(stmt) stmt
|
178 |
|
|
# define BOUNDS_CHECKING_OFF_IN_EXPR(expr) (expr)
|
179 |
|
|
#endif
|
180 |
|
|
|
181 |
|
|
#if !defined(__lzo_inline)
|
182 |
|
|
# define __lzo_inline
|
183 |
|
|
#endif
|
184 |
|
|
#if !defined(__lzo_forceinline)
|
185 |
|
|
# define __lzo_forceinline
|
186 |
|
|
#endif
|
187 |
|
|
#if !defined(__lzo_noinline)
|
188 |
|
|
# define __lzo_noinline
|
189 |
|
|
#endif
|
190 |
|
|
|
191 |
|
|
|
192 |
|
|
/***********************************************************************
|
193 |
|
|
//
|
194 |
|
|
************************************************************************/
|
195 |
|
|
|
196 |
|
|
#if 1
|
197 |
|
|
# define LZO_BYTE(x) ((unsigned char) (x))
|
198 |
|
|
#else
|
199 |
|
|
# define LZO_BYTE(x) ((unsigned char) ((x) & 0xff))
|
200 |
|
|
#endif
|
201 |
|
|
|
202 |
|
|
#define LZO_MAX(a,b) ((a) >= (b) ? (a) : (b))
|
203 |
|
|
#define LZO_MIN(a,b) ((a) <= (b) ? (a) : (b))
|
204 |
|
|
#define LZO_MAX3(a,b,c) ((a) >= (b) ? LZO_MAX(a,c) : LZO_MAX(b,c))
|
205 |
|
|
#define LZO_MIN3(a,b,c) ((a) <= (b) ? LZO_MIN(a,c) : LZO_MIN(b,c))
|
206 |
|
|
|
207 |
|
|
#define lzo_sizeof(type) ((lzo_uint) (sizeof(type)))
|
208 |
|
|
|
209 |
|
|
#define LZO_HIGH(array) ((lzo_uint) (sizeof(array)/sizeof(*(array))))
|
210 |
|
|
|
211 |
|
|
/* this always fits into 16 bits */
|
212 |
|
|
#define LZO_SIZE(bits) (1u << (bits))
|
213 |
|
|
#define LZO_MASK(bits) (LZO_SIZE(bits) - 1)
|
214 |
|
|
|
215 |
|
|
#define LZO_LSIZE(bits) (1ul << (bits))
|
216 |
|
|
#define LZO_LMASK(bits) (LZO_LSIZE(bits) - 1)
|
217 |
|
|
|
218 |
|
|
#define LZO_USIZE(bits) ((lzo_uint) 1 << (bits))
|
219 |
|
|
#define LZO_UMASK(bits) (LZO_USIZE(bits) - 1)
|
220 |
|
|
|
221 |
|
|
#if !defined(DMUL)
|
222 |
|
|
#if 0
|
223 |
|
|
/* 32*32 multiplies may be faster than 64*64 on some 64-bit machines,
|
224 |
|
|
* but then we need extra casts from unsigned<->size_t */
|
225 |
|
|
# define DMUL(a,b) ((lzo_xint) ((lzo_uint32)(a) * (lzo_uint32)(b)))
|
226 |
|
|
#else
|
227 |
|
|
# define DMUL(a,b) ((lzo_xint) ((a) * (b)))
|
228 |
|
|
#endif
|
229 |
|
|
#endif
|
230 |
|
|
|
231 |
|
|
|
232 |
|
|
/***********************************************************************
|
233 |
|
|
// compiler and architecture specific stuff
|
234 |
|
|
************************************************************************/
|
235 |
|
|
|
236 |
|
|
/* Some defines that indicate if memory can be accessed at unaligned
|
237 |
|
|
* memory addresses. You should also test that this is actually faster
|
238 |
|
|
* even if it is allowed by your system.
|
239 |
|
|
*/
|
240 |
|
|
|
241 |
|
|
#if 1 && !defined(LZO_CFG_NO_UNALIGNED)
|
242 |
|
|
#if 1 && (LZO_ARCH_AMD64 || LZO_ARCH_I386)
|
243 |
|
|
# if (LZO_SIZEOF_SHORT == 2)
|
244 |
|
|
# define LZO_UNALIGNED_OK_2
|
245 |
|
|
# endif
|
246 |
|
|
# if (LZO_SIZEOF_INT == 4)
|
247 |
|
|
# define LZO_UNALIGNED_OK_4
|
248 |
|
|
# endif
|
249 |
|
|
#endif
|
250 |
|
|
#endif
|
251 |
|
|
|
252 |
|
|
#if defined(LZO_UNALIGNED_OK_2)
|
253 |
|
|
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(short) == 2)
|
254 |
|
|
#endif
|
255 |
|
|
#if defined(LZO_UNALIGNED_OK_4)
|
256 |
|
|
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint32) == 4)
|
257 |
|
|
#elif defined(LZO_ALIGNED_OK_4)
|
258 |
|
|
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint32) == 4)
|
259 |
|
|
#endif
|
260 |
|
|
|
261 |
|
|
|
262 |
|
|
/* Fast memcpy that copies multiples of 8 byte chunks.
|
263 |
|
|
* len is the number of bytes.
|
264 |
|
|
* note: all parameters must be lvalues, len >= 8
|
265 |
|
|
* dest and src advance, len is undefined afterwards
|
266 |
|
|
*/
|
267 |
|
|
|
268 |
|
|
#define MEMCPY8_DS(dest,src,len) \
|
269 |
|
|
lzo_memcpy(dest,src,len); dest += len; src += len
|
270 |
|
|
|
271 |
|
|
#define BZERO8_PTR(s,l,n) \
|
272 |
|
|
lzo_memset((lzo_voidp)(s),0,(lzo_uint)(l)*(n))
|
273 |
|
|
|
274 |
|
|
#define MEMCPY_DS(dest,src,len) \
|
275 |
|
|
do *dest++ = *src++; while (--len > 0)
|
276 |
|
|
|
277 |
|
|
|
278 |
|
|
/***********************************************************************
|
279 |
|
|
// some globals
|
280 |
|
|
************************************************************************/
|
281 |
|
|
|
282 |
|
|
__LZO_EXTERN_C int __lzo_init_done;
|
283 |
|
|
__LZO_EXTERN_C const char __lzo_copyright[];
|
284 |
|
|
LZO_EXTERN(const lzo_bytep) lzo_copyright(void);
|
285 |
|
|
|
286 |
|
|
|
287 |
|
|
/***********************************************************************
|
288 |
|
|
//
|
289 |
|
|
************************************************************************/
|
290 |
|
|
|
291 |
|
|
#include "lzo_ptr.h"
|
292 |
|
|
|
293 |
|
|
|
294 |
|
|
/* Generate compressed data in a deterministic way.
|
295 |
|
|
* This is fully portable, and compression can be faster as well.
|
296 |
|
|
* A reason NOT to be deterministic is when the block size is
|
297 |
|
|
* very small (e.g. 8kB) or the dictionary is big, because
|
298 |
|
|
* then the initialization of the dictionary becomes a relevant
|
299 |
|
|
* magnitude for compression speed.
|
300 |
|
|
*/
|
301 |
|
|
#define LZO_DETERMINISTIC
|
302 |
|
|
|
303 |
|
|
|
304 |
|
|
#define LZO_DICT_USE_PTR
|
305 |
|
|
#if 0 && (LZO_ARCH_I086)
|
306 |
|
|
# undef LZO_DICT_USE_PTR
|
307 |
|
|
#endif
|
308 |
|
|
|
309 |
|
|
#if defined(LZO_DICT_USE_PTR)
|
310 |
|
|
# define lzo_dict_t const lzo_bytep
|
311 |
|
|
# define lzo_dict_p lzo_dict_t __LZO_MMODEL *
|
312 |
|
|
#else
|
313 |
|
|
# define lzo_dict_t lzo_uint
|
314 |
|
|
# define lzo_dict_p lzo_dict_t __LZO_MMODEL *
|
315 |
|
|
#endif
|
316 |
|
|
|
317 |
|
|
|
318 |
|
|
#endif /* already included */
|
319 |
|
|
|
320 |
|
|
/*
|
321 |
|
|
vi:ts=4:et
|
322 |
|
|
*/
|
323 |
|
|
|