• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* minilzo.c -- mini subset of the LZO real-time data compression library
2 
3    This file is part of the LZO real-time data compression library.
4 
5    Copyright (C) 1996-2014 Markus Franz Xaver Johannes Oberhumer
6    All Rights Reserved.
7 
8    The LZO library is free software; you can redistribute it and/or
9    modify it under the terms of the GNU General Public License as
10    published by the Free Software Foundation; either version 2 of
11    the License, or (at your option) any later version.
12 
13    The LZO library is distributed in the hope that it will be useful,
14    but WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16    GNU General Public License for more details.
17 
18    You should have received a copy of the GNU General Public License
19    along with the LZO library; see the file COPYING.
20    If not, write to the Free Software Foundation, Inc.,
21    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 
23    Markus F.X.J. Oberhumer
24    <markus@oberhumer.com>
25    http://www.oberhumer.com/opensource/lzo/
26  */
27 
28 /*
29  * NOTE:
30  *   the full LZO package can be found at
31  *   http://www.oberhumer.com/opensource/lzo/
32  */
33 
34 #define __LZO_IN_MINILZO 1
35 
36 #if defined(LZO_CFG_FREESTANDING)
37 #  undef MINILZO_HAVE_CONFIG_H
38 #  define LZO_LIBC_FREESTANDING 1
39 #  define LZO_OS_FREESTANDING 1
40 #endif
41 
42 #ifdef MINILZO_HAVE_CONFIG_H
43 #  include <config.h>
44 #endif
45 #include <limits.h>
46 #include <stddef.h>
47 #if defined(MINILZO_CFG_USE_INTERNAL_LZODEFS)
48 
49 #ifndef __LZODEFS_H_INCLUDED
50 #define __LZODEFS_H_INCLUDED 1
51 
52 #if defined(__CYGWIN32__) && !defined(__CYGWIN__)
53 #  define __CYGWIN__ __CYGWIN32__
54 #endif
55 #if 1 && defined(__INTERIX) && defined(__GNUC__) && !defined(_ALL_SOURCE)
56 #  define _ALL_SOURCE 1
57 #endif
58 #if defined(__mips__) && defined(__R5900__)
59 #  if !defined(__LONG_MAX__)
60 #    define __LONG_MAX__ 9223372036854775807L
61 #  endif
62 #endif
63 #if !defined(LZO_CFG_NO_DISABLE_WUNDEF)
64 #if defined(__ARMCC_VERSION)
65 #  pragma diag_suppress 193
66 #elif defined(__clang__) && defined(__clang_minor__)
67 #  pragma clang diagnostic ignored "-Wundef"
68 #elif defined(__INTEL_COMPILER)
69 #  pragma warning(disable: 193)
70 #elif defined(__KEIL__) && defined(__C166__)
71 #  pragma warning disable = 322
72 #elif defined(__GNUC__) && defined(__GNUC_MINOR__) && !defined(__PATHSCALE__)
73 #  if ((__GNUC__-0) >= 5 || ((__GNUC__-0) == 4 && (__GNUC_MINOR__-0) >= 2))
74 #    pragma GCC diagnostic ignored "-Wundef"
75 #  endif
76 #elif defined(_MSC_VER) && !defined(__clang__) && !defined(__INTEL_COMPILER) && !defined(__MWERKS__)
77 #  if ((_MSC_VER-0) >= 1300)
78 #    pragma warning(disable: 4668)
79 #  endif
80 #endif
81 #endif
82 #if 0 && defined(__POCC__) && defined(_WIN32)
83 #  if (__POCC__ >= 400)
84 #    pragma warn(disable: 2216)
85 #  endif
86 #endif
87 #if 0 && defined(__WATCOMC__)
88 #  if (__WATCOMC__ >= 1050) && (__WATCOMC__ < 1060)
89 #    pragma warning 203 9
90 #  endif
91 #endif
92 #if defined(__BORLANDC__) && defined(__MSDOS__) && !defined(__FLAT__)
93 #  pragma option -h
94 #endif
95 #if !(LZO_CFG_NO_DISABLE_WCRTNONSTDC)
96 #ifndef _CRT_NONSTDC_NO_DEPRECATE
97 #define _CRT_NONSTDC_NO_DEPRECATE 1
98 #endif
99 #ifndef _CRT_NONSTDC_NO_WARNINGS
100 #define _CRT_NONSTDC_NO_WARNINGS 1
101 #endif
102 #ifndef _CRT_SECURE_NO_DEPRECATE
103 #define _CRT_SECURE_NO_DEPRECATE 1
104 #endif
105 #ifndef _CRT_SECURE_NO_WARNINGS
106 #define _CRT_SECURE_NO_WARNINGS 1
107 #endif
108 #endif
109 #if 0
110 #define LZO_0xffffUL            0xfffful
111 #define LZO_0xffffffffUL        0xfffffffful
112 #else
113 #define LZO_0xffffUL            65535ul
114 #define LZO_0xffffffffUL        4294967295ul
115 #endif
116 #define LZO_0xffffL             LZO_0xffffUL
117 #define LZO_0xffffffffL         LZO_0xffffffffUL
118 #if (LZO_0xffffL == LZO_0xffffffffL)
119 #  error "your preprocessor is broken 1"
120 #endif
121 #if (16ul * 16384ul != 262144ul)
122 #  error "your preprocessor is broken 2"
123 #endif
124 #if 0
125 #if (32767 >= 4294967295ul)
126 #  error "your preprocessor is broken 3"
127 #endif
128 #if (65535u >= 4294967295ul)
129 #  error "your preprocessor is broken 4"
130 #endif
131 #endif
132 #if defined(__COUNTER__)
133 #  ifndef LZO_CFG_USE_COUNTER
134 #  define LZO_CFG_USE_COUNTER 1
135 #  endif
136 #else
137 #  undef LZO_CFG_USE_COUNTER
138 #endif
139 #if (UINT_MAX == LZO_0xffffL)
140 #if defined(__ZTC__) && defined(__I86__) && !defined(__OS2__)
141 #  if !defined(MSDOS)
142 #    define MSDOS 1
143 #  endif
144 #  if !defined(_MSDOS)
145 #    define _MSDOS 1
146 #  endif
147 #elif 0 && defined(__VERSION) && defined(MB_LEN_MAX)
148 #  if (__VERSION == 520) && (MB_LEN_MAX == 1)
149 #    if !defined(__AZTEC_C__)
150 #      define __AZTEC_C__ __VERSION
151 #    endif
152 #    if !defined(__DOS__)
153 #      define __DOS__ 1
154 #    endif
155 #  endif
156 #endif
157 #endif
158 #if defined(_MSC_VER) && defined(M_I86HM) && (UINT_MAX == LZO_0xffffL)
159 #  define ptrdiff_t long
160 #  define _PTRDIFF_T_DEFINED 1
161 #endif
162 #if (UINT_MAX == LZO_0xffffL)
163 #  undef __LZO_RENAME_A
164 #  undef __LZO_RENAME_B
165 #  if defined(__AZTEC_C__) && defined(__DOS__)
166 #    define __LZO_RENAME_A 1
167 #  elif defined(_MSC_VER) && defined(MSDOS)
168 #    if (_MSC_VER < 600)
169 #      define __LZO_RENAME_A 1
170 #    elif (_MSC_VER < 700)
171 #      define __LZO_RENAME_B 1
172 #    endif
173 #  elif defined(__TSC__) && defined(__OS2__)
174 #    define __LZO_RENAME_A 1
175 #  elif defined(__MSDOS__) && defined(__TURBOC__) && (__TURBOC__ < 0x0410)
176 #    define __LZO_RENAME_A 1
177 #  elif defined(__PACIFIC__) && defined(DOS)
178 #    if !defined(__far)
179 #      define __far far
180 #    endif
181 #    if !defined(__near)
182 #      define __near near
183 #    endif
184 #  endif
185 #  if defined(__LZO_RENAME_A)
186 #    if !defined(__cdecl)
187 #      define __cdecl cdecl
188 #    endif
189 #    if !defined(__far)
190 #      define __far far
191 #    endif
192 #    if !defined(__huge)
193 #      define __huge huge
194 #    endif
195 #    if !defined(__near)
196 #      define __near near
197 #    endif
198 #    if !defined(__pascal)
199 #      define __pascal pascal
200 #    endif
201 #    if !defined(__huge)
202 #      define __huge huge
203 #    endif
204 #  elif defined(__LZO_RENAME_B)
205 #    if !defined(__cdecl)
206 #      define __cdecl _cdecl
207 #    endif
208 #    if !defined(__far)
209 #      define __far _far
210 #    endif
211 #    if !defined(__huge)
212 #      define __huge _huge
213 #    endif
214 #    if !defined(__near)
215 #      define __near _near
216 #    endif
217 #    if !defined(__pascal)
218 #      define __pascal _pascal
219 #    endif
220 #  elif (defined(__PUREC__) || defined(__TURBOC__)) && defined(__TOS__)
221 #    if !defined(__cdecl)
222 #      define __cdecl cdecl
223 #    endif
224 #    if !defined(__pascal)
225 #      define __pascal pascal
226 #    endif
227 #  endif
228 #  undef __LZO_RENAME_A
229 #  undef __LZO_RENAME_B
230 #endif
231 #if (UINT_MAX == LZO_0xffffL)
232 #if defined(__AZTEC_C__) && defined(__DOS__)
233 #  define LZO_BROKEN_CDECL_ALT_SYNTAX 1
234 #elif defined(_MSC_VER) && defined(MSDOS)
235 #  if (_MSC_VER < 600)
236 #    define LZO_BROKEN_INTEGRAL_CONSTANTS 1
237 #  endif
238 #  if (_MSC_VER < 700)
239 #    define LZO_BROKEN_INTEGRAL_PROMOTION 1
240 #    define LZO_BROKEN_SIZEOF 1
241 #  endif
242 #elif defined(__PACIFIC__) && defined(DOS)
243 #  define LZO_BROKEN_INTEGRAL_CONSTANTS 1
244 #elif defined(__TURBOC__) && defined(__MSDOS__)
245 #  if (__TURBOC__ < 0x0150)
246 #    define LZO_BROKEN_CDECL_ALT_SYNTAX 1
247 #    define LZO_BROKEN_INTEGRAL_CONSTANTS 1
248 #    define LZO_BROKEN_INTEGRAL_PROMOTION 1
249 #  endif
250 #  if (__TURBOC__ < 0x0200)
251 #    define LZO_BROKEN_SIZEOF 1
252 #  endif
253 #  if (__TURBOC__ < 0x0400) && defined(__cplusplus)
254 #    define LZO_BROKEN_CDECL_ALT_SYNTAX 1
255 #  endif
256 #elif (defined(__PUREC__) || defined(__TURBOC__)) && defined(__TOS__)
257 #  define LZO_BROKEN_CDECL_ALT_SYNTAX 1
258 #  define LZO_BROKEN_SIZEOF 1
259 #endif
260 #endif
261 #if defined(__WATCOMC__) && (__WATCOMC__ < 900)
262 #  define LZO_BROKEN_INTEGRAL_CONSTANTS 1
263 #endif
264 #if defined(_CRAY) && defined(_CRAY1)
265 #  define LZO_BROKEN_SIGNED_RIGHT_SHIFT 1
266 #endif
267 #define LZO_PP_STRINGIZE(x)             #x
268 #define LZO_PP_MACRO_EXPAND(x)          LZO_PP_STRINGIZE(x)
269 #define LZO_PP_CONCAT0()                /*empty*/
270 #define LZO_PP_CONCAT1(a)               a
271 #define LZO_PP_CONCAT2(a,b)             a ## b
272 #define LZO_PP_CONCAT3(a,b,c)           a ## b ## c
273 #define LZO_PP_CONCAT4(a,b,c,d)         a ## b ## c ## d
274 #define LZO_PP_CONCAT5(a,b,c,d,e)       a ## b ## c ## d ## e
275 #define LZO_PP_CONCAT6(a,b,c,d,e,f)     a ## b ## c ## d ## e ## f
276 #define LZO_PP_CONCAT7(a,b,c,d,e,f,g)   a ## b ## c ## d ## e ## f ## g
277 #define LZO_PP_ECONCAT0()               LZO_PP_CONCAT0()
278 #define LZO_PP_ECONCAT1(a)              LZO_PP_CONCAT1(a)
279 #define LZO_PP_ECONCAT2(a,b)            LZO_PP_CONCAT2(a,b)
280 #define LZO_PP_ECONCAT3(a,b,c)          LZO_PP_CONCAT3(a,b,c)
281 #define LZO_PP_ECONCAT4(a,b,c,d)        LZO_PP_CONCAT4(a,b,c,d)
282 #define LZO_PP_ECONCAT5(a,b,c,d,e)      LZO_PP_CONCAT5(a,b,c,d,e)
283 #define LZO_PP_ECONCAT6(a,b,c,d,e,f)    LZO_PP_CONCAT6(a,b,c,d,e,f)
284 #define LZO_PP_ECONCAT7(a,b,c,d,e,f,g)  LZO_PP_CONCAT7(a,b,c,d,e,f,g)
285 #define LZO_PP_EMPTY                    /*empty*/
286 #define LZO_PP_EMPTY0()                 /*empty*/
287 #define LZO_PP_EMPTY1(a)                /*empty*/
288 #define LZO_PP_EMPTY2(a,b)              /*empty*/
289 #define LZO_PP_EMPTY3(a,b,c)            /*empty*/
290 #define LZO_PP_EMPTY4(a,b,c,d)          /*empty*/
291 #define LZO_PP_EMPTY5(a,b,c,d,e)        /*empty*/
292 #define LZO_PP_EMPTY6(a,b,c,d,e,f)      /*empty*/
293 #define LZO_PP_EMPTY7(a,b,c,d,e,f,g)    /*empty*/
294 #if 1
295 #define LZO_CPP_STRINGIZE(x)            #x
296 #define LZO_CPP_MACRO_EXPAND(x)         LZO_CPP_STRINGIZE(x)
297 #define LZO_CPP_CONCAT2(a,b)            a ## b
298 #define LZO_CPP_CONCAT3(a,b,c)          a ## b ## c
299 #define LZO_CPP_CONCAT4(a,b,c,d)        a ## b ## c ## d
300 #define LZO_CPP_CONCAT5(a,b,c,d,e)      a ## b ## c ## d ## e
301 #define LZO_CPP_CONCAT6(a,b,c,d,e,f)    a ## b ## c ## d ## e ## f
302 #define LZO_CPP_CONCAT7(a,b,c,d,e,f,g)  a ## b ## c ## d ## e ## f ## g
303 #define LZO_CPP_ECONCAT2(a,b)           LZO_CPP_CONCAT2(a,b)
304 #define LZO_CPP_ECONCAT3(a,b,c)         LZO_CPP_CONCAT3(a,b,c)
305 #define LZO_CPP_ECONCAT4(a,b,c,d)       LZO_CPP_CONCAT4(a,b,c,d)
306 #define LZO_CPP_ECONCAT5(a,b,c,d,e)     LZO_CPP_CONCAT5(a,b,c,d,e)
307 #define LZO_CPP_ECONCAT6(a,b,c,d,e,f)   LZO_CPP_CONCAT6(a,b,c,d,e,f)
308 #define LZO_CPP_ECONCAT7(a,b,c,d,e,f,g) LZO_CPP_CONCAT7(a,b,c,d,e,f,g)
309 #endif
310 #define __LZO_MASK_GEN(o,b)     (((((o) << ((b)-!!(b))) - (o)) << 1) + (o)*!!(b))
311 #if 1 && defined(__cplusplus)
312 #  if !defined(__STDC_CONSTANT_MACROS)
313 #    define __STDC_CONSTANT_MACROS 1
314 #  endif
315 #  if !defined(__STDC_LIMIT_MACROS)
316 #    define __STDC_LIMIT_MACROS 1
317 #  endif
318 #endif
319 #if defined(__cplusplus)
320 #  define LZO_EXTERN_C          extern "C"
321 #  define LZO_EXTERN_C_BEGIN    extern "C" {
322 #  define LZO_EXTERN_C_END      }
323 #else
324 #  define LZO_EXTERN_C          extern
325 #  define LZO_EXTERN_C_BEGIN    /*empty*/
326 #  define LZO_EXTERN_C_END      /*empty*/
327 #endif
328 #if !defined(__LZO_OS_OVERRIDE)
329 #if (LZO_OS_FREESTANDING)
330 #  define LZO_INFO_OS           "freestanding"
331 #elif (LZO_OS_EMBEDDED)
332 #  define LZO_INFO_OS           "embedded"
333 #elif 1 && defined(__IAR_SYSTEMS_ICC__)
334 #  define LZO_OS_EMBEDDED       1
335 #  define LZO_INFO_OS           "embedded"
336 #elif defined(__CYGWIN__) && defined(__GNUC__)
337 #  define LZO_OS_CYGWIN         1
338 #  define LZO_INFO_OS           "cygwin"
339 #elif defined(__EMX__) && defined(__GNUC__)
340 #  define LZO_OS_EMX            1
341 #  define LZO_INFO_OS           "emx"
342 #elif defined(__BEOS__)
343 #  define LZO_OS_BEOS           1
344 #  define LZO_INFO_OS           "beos"
345 #elif defined(__Lynx__)
346 #  define LZO_OS_LYNXOS         1
347 #  define LZO_INFO_OS           "lynxos"
348 #elif defined(__OS400__)
349 #  define LZO_OS_OS400          1
350 #  define LZO_INFO_OS           "os400"
351 #elif defined(__QNX__)
352 #  define LZO_OS_QNX            1
353 #  define LZO_INFO_OS           "qnx"
354 #elif defined(__BORLANDC__) && defined(__DPMI32__) && (__BORLANDC__ >= 0x0460)
355 #  define LZO_OS_DOS32          1
356 #  define LZO_INFO_OS           "dos32"
357 #elif defined(__BORLANDC__) && defined(__DPMI16__)
358 #  define LZO_OS_DOS16          1
359 #  define LZO_INFO_OS           "dos16"
360 #elif defined(__ZTC__) && defined(DOS386)
361 #  define LZO_OS_DOS32          1
362 #  define LZO_INFO_OS           "dos32"
363 #elif defined(__OS2__) || defined(__OS2V2__)
364 #  if (UINT_MAX == LZO_0xffffL)
365 #    define LZO_OS_OS216        1
366 #    define LZO_INFO_OS         "os216"
367 #  elif (UINT_MAX == LZO_0xffffffffL)
368 #    define LZO_OS_OS2          1
369 #    define LZO_INFO_OS         "os2"
370 #  else
371 #    error "check your limits.h header"
372 #  endif
373 #elif defined(__WIN64__) || defined(_WIN64) || defined(WIN64)
374 #  define LZO_OS_WIN64          1
375 #  define LZO_INFO_OS           "win64"
376 #elif defined(__WIN32__) || defined(_WIN32) || defined(WIN32) || defined(__WINDOWS_386__)
377 #  define LZO_OS_WIN32          1
378 #  define LZO_INFO_OS           "win32"
379 #elif defined(__MWERKS__) && defined(__INTEL__)
380 #  define LZO_OS_WIN32          1
381 #  define LZO_INFO_OS           "win32"
382 #elif defined(__WINDOWS__) || defined(_WINDOWS) || defined(_Windows)
383 #  if (UINT_MAX == LZO_0xffffL)
384 #    define LZO_OS_WIN16        1
385 #    define LZO_INFO_OS         "win16"
386 #  elif (UINT_MAX == LZO_0xffffffffL)
387 #    define LZO_OS_WIN32        1
388 #    define LZO_INFO_OS         "win32"
389 #  else
390 #    error "check your limits.h header"
391 #  endif
392 #elif defined(__DOS__) || defined(__MSDOS__) || defined(_MSDOS) || defined(MSDOS) || (defined(__PACIFIC__) && defined(DOS))
393 #  if (UINT_MAX == LZO_0xffffL)
394 #    define LZO_OS_DOS16        1
395 #    define LZO_INFO_OS         "dos16"
396 #  elif (UINT_MAX == LZO_0xffffffffL)
397 #    define LZO_OS_DOS32        1
398 #    define LZO_INFO_OS         "dos32"
399 #  else
400 #    error "check your limits.h header"
401 #  endif
402 #elif defined(__WATCOMC__)
403 #  if defined(__NT__) && (UINT_MAX == LZO_0xffffL)
404 #    define LZO_OS_DOS16        1
405 #    define LZO_INFO_OS         "dos16"
406 #  elif defined(__NT__) && (__WATCOMC__ < 1100)
407 #    define LZO_OS_WIN32        1
408 #    define LZO_INFO_OS         "win32"
409 #  elif defined(__linux__) || defined(__LINUX__)
410 #    define LZO_OS_POSIX        1
411 #    define LZO_INFO_OS         "posix"
412 #  else
413 #    error "please specify a target using the -bt compiler option"
414 #  endif
415 #elif defined(__palmos__)
416 #  define LZO_OS_PALMOS         1
417 #  define LZO_INFO_OS           "palmos"
418 #elif defined(__TOS__) || defined(__atarist__)
419 #  define LZO_OS_TOS            1
420 #  define LZO_INFO_OS           "tos"
421 #elif defined(macintosh) && !defined(__ppc__)
422 #  define LZO_OS_MACCLASSIC     1
423 #  define LZO_INFO_OS           "macclassic"
424 #elif defined(__VMS)
425 #  define LZO_OS_VMS            1
426 #  define LZO_INFO_OS           "vms"
427 #elif (defined(__mips__) && defined(__R5900__)) || defined(__MIPS_PSX2__)
428 #  define LZO_OS_CONSOLE        1
429 #  define LZO_OS_CONSOLE_PS2    1
430 #  define LZO_INFO_OS           "console"
431 #  define LZO_INFO_OS_CONSOLE   "ps2"
432 #elif defined(__mips__) && defined(__psp__)
433 #  define LZO_OS_CONSOLE        1
434 #  define LZO_OS_CONSOLE_PSP    1
435 #  define LZO_INFO_OS           "console"
436 #  define LZO_INFO_OS_CONSOLE   "psp"
437 #else
438 #  define LZO_OS_POSIX          1
439 #  define LZO_INFO_OS           "posix"
440 #endif
441 #if (LZO_OS_POSIX)
442 #  if defined(_AIX) || defined(__AIX__) || defined(__aix__)
443 #    define LZO_OS_POSIX_AIX        1
444 #    define LZO_INFO_OS_POSIX       "aix"
445 #  elif defined(__FreeBSD__)
446 #    define LZO_OS_POSIX_FREEBSD    1
447 #    define LZO_INFO_OS_POSIX       "freebsd"
448 #  elif defined(__hpux__) || defined(__hpux)
449 #    define LZO_OS_POSIX_HPUX       1
450 #    define LZO_INFO_OS_POSIX       "hpux"
451 #  elif defined(__INTERIX)
452 #    define LZO_OS_POSIX_INTERIX    1
453 #    define LZO_INFO_OS_POSIX       "interix"
454 #  elif defined(__IRIX__) || defined(__irix__)
455 #    define LZO_OS_POSIX_IRIX       1
456 #    define LZO_INFO_OS_POSIX       "irix"
457 #  elif defined(__linux__) || defined(__linux) || defined(__LINUX__)
458 #    define LZO_OS_POSIX_LINUX      1
459 #    define LZO_INFO_OS_POSIX       "linux"
460 #  elif defined(__APPLE__) && defined(__MACH__)
461 #    if ((__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__-0) >= 20000)
462 #      define LZO_OS_POSIX_DARWIN     1040
463 #      define LZO_INFO_OS_POSIX       "darwin_iphone"
464 #    elif ((__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__-0) >= 1040)
465 #      define LZO_OS_POSIX_DARWIN     __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
466 #      define LZO_INFO_OS_POSIX       "darwin"
467 #    else
468 #      define LZO_OS_POSIX_DARWIN     1
469 #      define LZO_INFO_OS_POSIX       "darwin"
470 #    endif
471 #    define LZO_OS_POSIX_MACOSX     LZO_OS_POSIX_DARWIN
472 #  elif defined(__minix__) || defined(__minix)
473 #    define LZO_OS_POSIX_MINIX      1
474 #    define LZO_INFO_OS_POSIX       "minix"
475 #  elif defined(__NetBSD__)
476 #    define LZO_OS_POSIX_NETBSD     1
477 #    define LZO_INFO_OS_POSIX       "netbsd"
478 #  elif defined(__OpenBSD__)
479 #    define LZO_OS_POSIX_OPENBSD    1
480 #    define LZO_INFO_OS_POSIX       "openbsd"
481 #  elif defined(__osf__)
482 #    define LZO_OS_POSIX_OSF        1
483 #    define LZO_INFO_OS_POSIX       "osf"
484 #  elif defined(__solaris__) || defined(__sun)
485 #    if defined(__SVR4) || defined(__svr4__)
486 #      define LZO_OS_POSIX_SOLARIS  1
487 #      define LZO_INFO_OS_POSIX     "solaris"
488 #    else
489 #      define LZO_OS_POSIX_SUNOS    1
490 #      define LZO_INFO_OS_POSIX     "sunos"
491 #    endif
492 #  elif defined(__ultrix__) || defined(__ultrix)
493 #    define LZO_OS_POSIX_ULTRIX     1
494 #    define LZO_INFO_OS_POSIX       "ultrix"
495 #  elif defined(_UNICOS)
496 #    define LZO_OS_POSIX_UNICOS     1
497 #    define LZO_INFO_OS_POSIX       "unicos"
498 #  else
499 #    define LZO_OS_POSIX_UNKNOWN    1
500 #    define LZO_INFO_OS_POSIX       "unknown"
501 #  endif
502 #endif
503 #endif
504 #if (LZO_OS_DOS16 || LZO_OS_OS216 || LZO_OS_WIN16)
505 #  if (UINT_MAX != LZO_0xffffL)
506 #    error "unexpected configuration - check your compiler defines"
507 #  endif
508 #  if (ULONG_MAX != LZO_0xffffffffL)
509 #    error "unexpected configuration - check your compiler defines"
510 #  endif
511 #endif
512 #if (LZO_OS_DOS32 || LZO_OS_OS2 || LZO_OS_WIN32 || LZO_OS_WIN64)
513 #  if (UINT_MAX != LZO_0xffffffffL)
514 #    error "unexpected configuration - check your compiler defines"
515 #  endif
516 #  if (ULONG_MAX != LZO_0xffffffffL)
517 #    error "unexpected configuration - check your compiler defines"
518 #  endif
519 #endif
520 #if defined(CIL) && defined(_GNUCC) && defined(__GNUC__)
521 #  define LZO_CC_CILLY          1
522 #  define LZO_INFO_CC           "Cilly"
523 #  if defined(__CILLY__)
524 #    define LZO_INFO_CCVER      LZO_PP_MACRO_EXPAND(__CILLY__)
525 #  else
526 #    define LZO_INFO_CCVER      "unknown"
527 #  endif
528 #elif 0 && defined(SDCC) && defined(__VERSION__) && !defined(__GNUC__)
529 #  define LZO_CC_SDCC           1
530 #  define LZO_INFO_CC           "sdcc"
531 #  define LZO_INFO_CCVER        LZO_PP_MACRO_EXPAND(SDCC)
532 #elif defined(__PATHSCALE__) && defined(__PATHCC_PATCHLEVEL__)
533 #  define LZO_CC_PATHSCALE      (__PATHCC__ * 0x10000L + (__PATHCC_MINOR__-0) * 0x100 + (__PATHCC_PATCHLEVEL__-0))
534 #  define LZO_INFO_CC           "Pathscale C"
535 #  define LZO_INFO_CCVER        __PATHSCALE__
536 #  if defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__VERSION__)
537 #    define LZO_CC_PATHSCALE_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100 + (__GNUC_PATCHLEVEL__-0))
538 #  endif
539 #elif defined(__INTEL_COMPILER) && ((__INTEL_COMPILER-0) > 0)
540 #  define LZO_CC_INTELC         __INTEL_COMPILER
541 #  define LZO_INFO_CC           "Intel C"
542 #  define LZO_INFO_CCVER        LZO_PP_MACRO_EXPAND(__INTEL_COMPILER)
543 #  if defined(_MSC_VER) && ((_MSC_VER-0) > 0)
544 #    define LZO_CC_INTELC_MSC   _MSC_VER
545 #  elif defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__VERSION__)
546 #    define LZO_CC_INTELC_GNUC   (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100 + (__GNUC_PATCHLEVEL__-0))
547 #  endif
548 #elif defined(__POCC__) && defined(_WIN32)
549 #  define LZO_CC_PELLESC        1
550 #  define LZO_INFO_CC           "Pelles C"
551 #  define LZO_INFO_CCVER        LZO_PP_MACRO_EXPAND(__POCC__)
552 #elif defined(__ARMCC_VERSION) && defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__VERSION__)
553 #  if defined(__GNUC_PATCHLEVEL__)
554 #    define LZO_CC_ARMCC_GNUC   (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100 + (__GNUC_PATCHLEVEL__-0))
555 #  else
556 #    define LZO_CC_ARMCC_GNUC   (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100)
557 #  endif
558 #  define LZO_CC_ARMCC          __ARMCC_VERSION
559 #  define LZO_INFO_CC           "ARM C Compiler"
560 #  define LZO_INFO_CCVER        __VERSION__
561 #elif defined(__clang__) && defined(__llvm__) && defined(__VERSION__)
562 #  if defined(__clang_major__) && defined(__clang_minor__) && defined(__clang_patchlevel__)
563 #    define LZO_CC_CLANG        (__clang_major__ * 0x10000L + (__clang_minor__-0) * 0x100 + (__clang_patchlevel__-0))
564 #  else
565 #    define LZO_CC_CLANG        0x010000L
566 #  endif
567 #  if defined(_MSC_VER) && ((_MSC_VER-0) > 0)
568 #    define LZO_CC_CLANG_MSC    _MSC_VER
569 #  elif defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__VERSION__)
570 #    define LZO_CC_CLANG_GNUC   (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100 + (__GNUC_PATCHLEVEL__-0))
571 #  endif
572 #  define LZO_INFO_CC           "clang"
573 #  define LZO_INFO_CCVER        __VERSION__
574 #elif defined(__llvm__) && defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__VERSION__)
575 #  if defined(__GNUC_PATCHLEVEL__)
576 #    define LZO_CC_LLVM_GNUC    (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100 + (__GNUC_PATCHLEVEL__-0))
577 #  else
578 #    define LZO_CC_LLVM_GNUC    (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100)
579 #  endif
580 #  define LZO_CC_LLVM           LZO_CC_LLVM_GNUC
581 #  define LZO_INFO_CC           "llvm-gcc"
582 #  define LZO_INFO_CCVER        __VERSION__
583 #elif defined(__ACK__) && defined(_ACK)
584 #  define LZO_CC_ACK            1
585 #  define LZO_INFO_CC           "Amsterdam Compiler Kit C"
586 #  define LZO_INFO_CCVER        "unknown"
587 #elif defined(__ARMCC_VERSION) && !defined(__GNUC__)
588 #  define LZO_CC_ARMCC          __ARMCC_VERSION
589 #  define LZO_CC_ARMCC_ARMCC    __ARMCC_VERSION
590 #  define LZO_INFO_CC           "ARM C Compiler"
591 #  define LZO_INFO_CCVER        LZO_PP_MACRO_EXPAND(__ARMCC_VERSION)
592 #elif defined(__AZTEC_C__)
593 #  define LZO_CC_AZTECC         1
594 #  define LZO_INFO_CC           "Aztec C"
595 #  define LZO_INFO_CCVER        LZO_PP_MACRO_EXPAND(__AZTEC_C__)
596 #elif defined(__CODEGEARC__)
597 #  define LZO_CC_CODEGEARC      1
598 #  define LZO_INFO_CC           "CodeGear C"
599 #  define LZO_INFO_CCVER        LZO_PP_MACRO_EXPAND(__CODEGEARC__)
600 #elif defined(__BORLANDC__)
601 #  define LZO_CC_BORLANDC       1
602 #  define LZO_INFO_CC           "Borland C"
603 #  define LZO_INFO_CCVER        LZO_PP_MACRO_EXPAND(__BORLANDC__)
604 #elif defined(_CRAYC) && defined(_RELEASE)
605 #  define LZO_CC_CRAYC          1
606 #  define LZO_INFO_CC           "Cray C"
607 #  define LZO_INFO_CCVER        LZO_PP_MACRO_EXPAND(_RELEASE)
608 #elif defined(__DMC__) && defined(__SC__)
609 #  define LZO_CC_DMC            1
610 #  define LZO_INFO_CC           "Digital Mars C"
611 #  define LZO_INFO_CCVER        LZO_PP_MACRO_EXPAND(__DMC__)
612 #elif defined(__DECC)
613 #  define LZO_CC_DECC           1
614 #  define LZO_INFO_CC           "DEC C"
615 #  define LZO_INFO_CCVER        LZO_PP_MACRO_EXPAND(__DECC)
616 #elif (defined(__ghs) || defined(__ghs__)) && defined(__GHS_VERSION_NUMBER) && ((__GHS_VERSION_NUMBER-0) > 0)
617 #  define LZO_CC_GHS            1
618 #  define LZO_INFO_CC           "Green Hills C"
619 #  define LZO_INFO_CCVER        LZO_PP_MACRO_EXPAND(__GHS_VERSION_NUMBER)
620 #  if defined(_MSC_VER) && ((_MSC_VER-0) > 0)
621 #    define LZO_CC_GHS_MSC      _MSC_VER
622 #  elif defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__VERSION__)
623 #    define LZO_CC_GHS_GNUC     (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100 + (__GNUC_PATCHLEVEL__-0))
624 #  endif
625 #elif defined(__HIGHC__)
626 #  define LZO_CC_HIGHC          1
627 #  define LZO_INFO_CC           "MetaWare High C"
628 #  define LZO_INFO_CCVER        "unknown"
629 #elif defined(__HP_aCC) && ((__HP_aCC-0) > 0)
630 #  define LZO_CC_HPACC          __HP_aCC
631 #  define LZO_INFO_CC           "HP aCC"
632 #  define LZO_INFO_CCVER        LZO_PP_MACRO_EXPAND(__HP_aCC)
633 #elif defined(__IAR_SYSTEMS_ICC__)
634 #  define LZO_CC_IARC           1
635 #  define LZO_INFO_CC           "IAR C"
636 #  if defined(__VER__)
637 #    define LZO_INFO_CCVER      LZO_PP_MACRO_EXPAND(__VER__)
638 #  else
639 #    define LZO_INFO_CCVER      "unknown"
640 #  endif
641 #elif defined(__IBMC__) && ((__IBMC__-0) > 0)
642 #  define LZO_CC_IBMC           __IBMC__
643 #  define LZO_INFO_CC           "IBM C"
644 #  define LZO_INFO_CCVER        LZO_PP_MACRO_EXPAND(__IBMC__)
645 #elif defined(__IBMCPP__) && ((__IBMCPP__-0) > 0)
646 #  define LZO_CC_IBMC           __IBMCPP__
647 #  define LZO_INFO_CC           "IBM C"
648 #  define LZO_INFO_CCVER        LZO_PP_MACRO_EXPAND(__IBMCPP__)
649 #elif defined(__KEIL__) && defined(__C166__)
650 #  define LZO_CC_KEILC          1
651 #  define LZO_INFO_CC           "Keil C"
652 #  define LZO_INFO_CCVER        LZO_PP_MACRO_EXPAND(__C166__)
653 #elif defined(__LCC__) && defined(_WIN32) && defined(__LCCOPTIMLEVEL)
654 #  define LZO_CC_LCCWIN32       1
655 #  define LZO_INFO_CC           "lcc-win32"
656 #  define LZO_INFO_CCVER        "unknown"
657 #elif defined(__LCC__)
658 #  define LZO_CC_LCC            1
659 #  define LZO_INFO_CC           "lcc"
660 #  if defined(__LCC_VERSION__)
661 #    define LZO_INFO_CCVER      LZO_PP_MACRO_EXPAND(__LCC_VERSION__)
662 #  else
663 #    define LZO_INFO_CCVER      "unknown"
664 #  endif
665 #elif defined(__MWERKS__) && ((__MWERKS__-0) > 0)
666 #  define LZO_CC_MWERKS         __MWERKS__
667 #  define LZO_INFO_CC           "Metrowerks C"
668 #  define LZO_INFO_CCVER        LZO_PP_MACRO_EXPAND(__MWERKS__)
669 #elif (defined(__NDPC__) || defined(__NDPX__)) && defined(__i386)
670 #  define LZO_CC_NDPC           1
671 #  define LZO_INFO_CC           "Microway NDP C"
672 #  define LZO_INFO_CCVER        "unknown"
673 #elif defined(__PACIFIC__)
674 #  define LZO_CC_PACIFICC       1
675 #  define LZO_INFO_CC           "Pacific C"
676 #  define LZO_INFO_CCVER        LZO_PP_MACRO_EXPAND(__PACIFIC__)
677 #elif defined(__PGI) && defined(__PGIC__) && defined(__PGIC_MINOR__)
678 #  if defined(__PGIC_PATCHLEVEL__)
679 #    define LZO_CC_PGI          (__PGIC__ * 0x10000L + (__PGIC_MINOR__-0) * 0x100 + (__PGIC_PATCHLEVEL__-0))
680 #    define LZO_INFO_CCVER      LZO_PP_MACRO_EXPAND(__PGIC__) "." LZO_PP_MACRO_EXPAND(__PGIC_MINOR__) "." LZO_PP_MACRO_EXPAND(__PGIC_PATCHLEVEL__)
681 #  else
682 #    define LZO_CC_PGI          (__PGIC__ * 0x10000L + (__PGIC_MINOR__-0) * 0x100)
683 #    define LZO_INFO_CCVER      LZO_PP_MACRO_EXPAND(__PGIC__) "." LZO_PP_MACRO_EXPAND(__PGIC_MINOR__) ".0"
684 #  endif
685 #  define LZO_INFO_CC           "Portland Group PGI C"
686 #elif defined(__PGI) && (defined(__linux__) || defined(__WIN32__))
687 #  define LZO_CC_PGI            1
688 #  define LZO_INFO_CC           "Portland Group PGI C"
689 #  define LZO_INFO_CCVER        "unknown"
690 #elif defined(__PUREC__) && defined(__TOS__)
691 #  define LZO_CC_PUREC          1
692 #  define LZO_INFO_CC           "Pure C"
693 #  define LZO_INFO_CCVER        LZO_PP_MACRO_EXPAND(__PUREC__)
694 #elif defined(__SC__) && defined(__ZTC__)
695 #  define LZO_CC_SYMANTECC      1
696 #  define LZO_INFO_CC           "Symantec C"
697 #  define LZO_INFO_CCVER        LZO_PP_MACRO_EXPAND(__SC__)
698 #elif defined(__SUNPRO_C)
699 #  define LZO_INFO_CC           "SunPro C"
700 #  if ((__SUNPRO_C-0) > 0)
701 #    define LZO_CC_SUNPROC      __SUNPRO_C
702 #    define LZO_INFO_CCVER      LZO_PP_MACRO_EXPAND(__SUNPRO_C)
703 #  else
704 #    define LZO_CC_SUNPROC      1
705 #    define LZO_INFO_CCVER      "unknown"
706 #  endif
707 #elif defined(__SUNPRO_CC)
708 #  define LZO_INFO_CC           "SunPro C"
709 #  if ((__SUNPRO_CC-0) > 0)
710 #    define LZO_CC_SUNPROC      __SUNPRO_CC
711 #    define LZO_INFO_CCVER      LZO_PP_MACRO_EXPAND(__SUNPRO_CC)
712 #  else
713 #    define LZO_CC_SUNPROC      1
714 #    define LZO_INFO_CCVER      "unknown"
715 #  endif
716 #elif defined(__TINYC__)
717 #  define LZO_CC_TINYC          1
718 #  define LZO_INFO_CC           "Tiny C"
719 #  define LZO_INFO_CCVER        LZO_PP_MACRO_EXPAND(__TINYC__)
720 #elif defined(__TSC__)
721 #  define LZO_CC_TOPSPEEDC      1
722 #  define LZO_INFO_CC           "TopSpeed C"
723 #  define LZO_INFO_CCVER        LZO_PP_MACRO_EXPAND(__TSC__)
724 #elif defined(__WATCOMC__)
725 #  define LZO_CC_WATCOMC        1
726 #  define LZO_INFO_CC           "Watcom C"
727 #  define LZO_INFO_CCVER        LZO_PP_MACRO_EXPAND(__WATCOMC__)
728 #elif defined(__TURBOC__)
729 #  define LZO_CC_TURBOC         1
730 #  define LZO_INFO_CC           "Turbo C"
731 #  define LZO_INFO_CCVER        LZO_PP_MACRO_EXPAND(__TURBOC__)
732 #elif defined(__ZTC__)
733 #  define LZO_CC_ZORTECHC       1
734 #  define LZO_INFO_CC           "Zortech C"
735 #  if ((__ZTC__-0) == 0x310)
736 #    define LZO_INFO_CCVER      "0x310"
737 #  else
738 #    define LZO_INFO_CCVER      LZO_PP_MACRO_EXPAND(__ZTC__)
739 #  endif
740 #elif defined(__GNUC__) && defined(__VERSION__)
741 #  if defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__)
742 #    define LZO_CC_GNUC         (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100 + (__GNUC_PATCHLEVEL__-0))
743 #  elif defined(__GNUC_MINOR__)
744 #    define LZO_CC_GNUC         (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100)
745 #  else
746 #    define LZO_CC_GNUC         (__GNUC__ * 0x10000L)
747 #  endif
748 #  define LZO_INFO_CC           "gcc"
749 #  define LZO_INFO_CCVER        __VERSION__
750 #elif defined(_MSC_VER) && ((_MSC_VER-0) > 0)
751 #  define LZO_CC_MSC            _MSC_VER
752 #  define LZO_INFO_CC           "Microsoft C"
753 #  if defined(_MSC_FULL_VER)
754 #    define LZO_INFO_CCVER      LZO_PP_MACRO_EXPAND(_MSC_VER) "." LZO_PP_MACRO_EXPAND(_MSC_FULL_VER)
755 #  else
756 #    define LZO_INFO_CCVER      LZO_PP_MACRO_EXPAND(_MSC_VER)
757 #  endif
758 #else
759 #  define LZO_CC_UNKNOWN        1
760 #  define LZO_INFO_CC           "unknown"
761 #  define LZO_INFO_CCVER        "unknown"
762 #endif
763 #if (LZO_CC_GNUC) && defined(__OPEN64__)
764 #  if defined(__OPENCC__) && defined(__OPENCC_MINOR__) && defined(__OPENCC_PATCHLEVEL__)
765 #    define LZO_CC_OPEN64       (__OPENCC__ * 0x10000L + (__OPENCC_MINOR__-0) * 0x100 + (__OPENCC_PATCHLEVEL__-0))
766 #    define LZO_CC_OPEN64_GNUC  LZO_CC_GNUC
767 #  endif
768 #endif
769 #if (LZO_CC_GNUC) && defined(__PCC__)
770 #  if defined(__PCC__) && defined(__PCC_MINOR__) && defined(__PCC_MINORMINOR__)
771 #    define LZO_CC_PCC          (__PCC__ * 0x10000L + (__PCC_MINOR__-0) * 0x100 + (__PCC_MINORMINOR__-0))
772 #    define LZO_CC_PCC_GNUC     LZO_CC_GNUC
773 #  endif
774 #endif
775 #if 0 && (LZO_CC_MSC && (_MSC_VER >= 1200)) && !defined(_MSC_FULL_VER)
776 #  error "LZO_CC_MSC: _MSC_FULL_VER is not defined"
777 #endif
778 #if !defined(__LZO_ARCH_OVERRIDE) && !(LZO_ARCH_GENERIC) && defined(_CRAY)
779 #  if (UINT_MAX > LZO_0xffffffffL) && defined(_CRAY)
780 #    if defined(_CRAYMPP) || defined(_CRAYT3D) || defined(_CRAYT3E)
781 #      define LZO_ARCH_CRAY_MPP     1
782 #    elif defined(_CRAY1)
783 #      define LZO_ARCH_CRAY_PVP     1
784 #    endif
785 #  endif
786 #endif
787 #if !defined(__LZO_ARCH_OVERRIDE)
788 #if (LZO_ARCH_GENERIC)
789 #  define LZO_INFO_ARCH             "generic"
790 #elif (LZO_OS_DOS16 || LZO_OS_OS216 || LZO_OS_WIN16)
791 #  define LZO_ARCH_I086             1
792 #  define LZO_INFO_ARCH             "i086"
793 #elif defined(__aarch64__)
794 #  define LZO_ARCH_ARM64            1
795 #  define LZO_INFO_ARCH             "arm64"
796 #elif defined(__alpha__) || defined(__alpha) || defined(_M_ALPHA)
797 #  define LZO_ARCH_ALPHA            1
798 #  define LZO_INFO_ARCH             "alpha"
799 #elif (LZO_ARCH_CRAY_MPP) && (defined(_CRAYT3D) || defined(_CRAYT3E))
800 #  define LZO_ARCH_ALPHA            1
801 #  define LZO_INFO_ARCH             "alpha"
802 #elif defined(__amd64__) || defined(__x86_64__) || defined(_M_AMD64)
803 #  define LZO_ARCH_AMD64            1
804 #  define LZO_INFO_ARCH             "amd64"
805 #elif defined(__thumb__) || (defined(_M_ARM) && defined(_M_THUMB))
806 #  define LZO_ARCH_ARM              1
807 #  define LZO_ARCH_ARM_THUMB        1
808 #  define LZO_INFO_ARCH             "arm_thumb"
809 #elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICCARM__)
810 #  define LZO_ARCH_ARM              1
811 #  if defined(__CPU_MODE__) && ((__CPU_MODE__-0) == 1)
812 #    define LZO_ARCH_ARM_THUMB      1
813 #    define LZO_INFO_ARCH           "arm_thumb"
814 #  elif defined(__CPU_MODE__) && ((__CPU_MODE__-0) == 2)
815 #    define LZO_INFO_ARCH           "arm"
816 #  else
817 #    define LZO_INFO_ARCH           "arm"
818 #  endif
819 #elif defined(__arm__) || defined(_M_ARM)
820 #  define LZO_ARCH_ARM              1
821 #  define LZO_INFO_ARCH             "arm"
822 #elif (UINT_MAX <= LZO_0xffffL) && defined(__AVR__)
823 #  define LZO_ARCH_AVR              1
824 #  define LZO_INFO_ARCH             "avr"
825 #elif defined(__avr32__) || defined(__AVR32__)
826 #  define LZO_ARCH_AVR32            1
827 #  define LZO_INFO_ARCH             "avr32"
828 #elif defined(__bfin__)
829 #  define LZO_ARCH_BLACKFIN         1
830 #  define LZO_INFO_ARCH             "blackfin"
831 #elif (UINT_MAX == LZO_0xffffL) && defined(__C166__)
832 #  define LZO_ARCH_C166             1
833 #  define LZO_INFO_ARCH             "c166"
834 #elif defined(__cris__)
835 #  define LZO_ARCH_CRIS             1
836 #  define LZO_INFO_ARCH             "cris"
837 #elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICCEZ80__)
838 #  define LZO_ARCH_EZ80             1
839 #  define LZO_INFO_ARCH             "ez80"
840 #elif defined(__H8300__) || defined(__H8300H__) || defined(__H8300S__) || defined(__H8300SX__)
841 #  define LZO_ARCH_H8300            1
842 #  define LZO_INFO_ARCH             "h8300"
843 #elif defined(__hppa__) || defined(__hppa)
844 #  define LZO_ARCH_HPPA             1
845 #  define LZO_INFO_ARCH             "hppa"
846 #elif defined(__386__) || defined(__i386__) || defined(__i386) || defined(_M_IX86) || defined(_M_I386)
847 #  define LZO_ARCH_I386             1
848 #  define LZO_ARCH_IA32             1
849 #  define LZO_INFO_ARCH             "i386"
850 #elif (LZO_CC_ZORTECHC && defined(__I86__))
851 #  define LZO_ARCH_I386             1
852 #  define LZO_ARCH_IA32             1
853 #  define LZO_INFO_ARCH             "i386"
854 #elif (LZO_OS_DOS32 && LZO_CC_HIGHC) && defined(_I386)
855 #  define LZO_ARCH_I386             1
856 #  define LZO_ARCH_IA32             1
857 #  define LZO_INFO_ARCH             "i386"
858 #elif defined(__ia64__) || defined(__ia64) || defined(_M_IA64)
859 #  define LZO_ARCH_IA64             1
860 #  define LZO_INFO_ARCH             "ia64"
861 #elif (UINT_MAX == LZO_0xffffL) && defined(__m32c__)
862 #  define LZO_ARCH_M16C             1
863 #  define LZO_INFO_ARCH             "m16c"
864 #elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICCM16C__)
865 #  define LZO_ARCH_M16C             1
866 #  define LZO_INFO_ARCH             "m16c"
867 #elif defined(__m32r__)
868 #  define LZO_ARCH_M32R             1
869 #  define LZO_INFO_ARCH             "m32r"
870 #elif (LZO_OS_TOS) || defined(__m68k__) || defined(__m68000__) || defined(__mc68000__) || defined(__mc68020__) || defined(_M_M68K)
871 #  define LZO_ARCH_M68K             1
872 #  define LZO_INFO_ARCH             "m68k"
873 #elif (UINT_MAX == LZO_0xffffL) && defined(__C251__)
874 #  define LZO_ARCH_MCS251           1
875 #  define LZO_INFO_ARCH             "mcs251"
876 #elif (UINT_MAX == LZO_0xffffL) && defined(__C51__)
877 #  define LZO_ARCH_MCS51            1
878 #  define LZO_INFO_ARCH             "mcs51"
879 #elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICC8051__)
880 #  define LZO_ARCH_MCS51            1
881 #  define LZO_INFO_ARCH             "mcs51"
882 #elif defined(__mips__) || defined(__mips) || defined(_MIPS_ARCH) || defined(_M_MRX000)
883 #  define LZO_ARCH_MIPS             1
884 #  define LZO_INFO_ARCH             "mips"
885 #elif (UINT_MAX == LZO_0xffffL) && defined(__MSP430__)
886 #  define LZO_ARCH_MSP430           1
887 #  define LZO_INFO_ARCH             "msp430"
888 #elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICC430__)
889 #  define LZO_ARCH_MSP430           1
890 #  define LZO_INFO_ARCH             "msp430"
891 #elif defined(__powerpc__) || defined(__powerpc) || defined(__ppc__) || defined(__PPC__) || defined(_M_PPC) || defined(_ARCH_PPC) || defined(_ARCH_PWR)
892 #  define LZO_ARCH_POWERPC          1
893 #  define LZO_INFO_ARCH             "powerpc"
894 #elif defined(__s390__) || defined(__s390) || defined(__s390x__) || defined(__s390x)
895 #  define LZO_ARCH_S390             1
896 #  define LZO_INFO_ARCH             "s390"
897 #elif defined(__sh__) || defined(_M_SH)
898 #  define LZO_ARCH_SH               1
899 #  define LZO_INFO_ARCH             "sh"
900 #elif defined(__sparc__) || defined(__sparc) || defined(__sparcv8)
901 #  define LZO_ARCH_SPARC            1
902 #  define LZO_INFO_ARCH             "sparc"
903 #elif defined(__SPU__)
904 #  define LZO_ARCH_SPU              1
905 #  define LZO_INFO_ARCH             "spu"
906 #elif (UINT_MAX == LZO_0xffffL) && defined(__z80)
907 #  define LZO_ARCH_Z80              1
908 #  define LZO_INFO_ARCH             "z80"
909 #elif (LZO_ARCH_CRAY_PVP)
910 #  if defined(_CRAYSV1)
911 #    define LZO_ARCH_CRAY_SV1       1
912 #    define LZO_INFO_ARCH           "cray_sv1"
913 #  elif (_ADDR64)
914 #    define LZO_ARCH_CRAY_T90       1
915 #    define LZO_INFO_ARCH           "cray_t90"
916 #  elif (_ADDR32)
917 #    define LZO_ARCH_CRAY_YMP       1
918 #    define LZO_INFO_ARCH           "cray_ymp"
919 #  else
920 #    define LZO_ARCH_CRAY_XMP       1
921 #    define LZO_INFO_ARCH           "cray_xmp"
922 #  endif
923 #else
924 #  define LZO_ARCH_UNKNOWN          1
925 #  define LZO_INFO_ARCH             "unknown"
926 #endif
927 #endif
928 #if 1 && (LZO_ARCH_UNKNOWN) && (LZO_OS_DOS32 || LZO_OS_OS2)
929 #  error "FIXME - missing define for CPU architecture"
930 #endif
931 #if 1 && (LZO_ARCH_UNKNOWN) && (LZO_OS_WIN32)
932 #  error "FIXME - missing LZO_OS_WIN32 define for CPU architecture"
933 #endif
934 #if 1 && (LZO_ARCH_UNKNOWN) && (LZO_OS_WIN64)
935 #  error "FIXME - missing LZO_OS_WIN64 define for CPU architecture"
936 #endif
937 #if (LZO_OS_OS216 || LZO_OS_WIN16)
938 #  define LZO_ARCH_I086PM           1
939 #elif 1 && (LZO_OS_DOS16 && defined(BLX286))
940 #  define LZO_ARCH_I086PM           1
941 #elif 1 && (LZO_OS_DOS16 && defined(DOSX286))
942 #  define LZO_ARCH_I086PM           1
943 #elif 1 && (LZO_OS_DOS16 && LZO_CC_BORLANDC && defined(__DPMI16__))
944 #  define LZO_ARCH_I086PM           1
945 #endif
946 #if (LZO_ARCH_AMD64 && !LZO_ARCH_X64)
947 #  define LZO_ARCH_X64              1
948 #elif (!LZO_ARCH_AMD64 && LZO_ARCH_X64) && defined(__LZO_ARCH_OVERRIDE)
949 #  define LZO_ARCH_AMD64            1
950 #endif
951 #if (LZO_ARCH_ARM64 && !LZO_ARCH_AARCH64)
952 #  define LZO_ARCH_AARCH64          1
953 #elif (!LZO_ARCH_ARM64 && LZO_ARCH_AARCH64) && defined(__LZO_ARCH_OVERRIDE)
954 #  define LZO_ARCH_ARM64            1
955 #endif
956 #if (LZO_ARCH_I386 && !LZO_ARCH_X86)
957 #  define LZO_ARCH_X86              1
958 #elif (!LZO_ARCH_I386 && LZO_ARCH_X86) && defined(__LZO_ARCH_OVERRIDE)
959 #  define LZO_ARCH_I386            1
960 #endif
961 #if (LZO_ARCH_AMD64 && !LZO_ARCH_X64) || (!LZO_ARCH_AMD64 && LZO_ARCH_X64)
962 #  error "unexpected configuration - check your compiler defines"
963 #endif
964 #if (LZO_ARCH_ARM64 && !LZO_ARCH_AARCH64) || (!LZO_ARCH_ARM64 && LZO_ARCH_AARCH64)
965 #  error "unexpected configuration - check your compiler defines"
966 #endif
967 #if (LZO_ARCH_I386 && !LZO_ARCH_X86) || (!LZO_ARCH_I386 && LZO_ARCH_X86)
968 #  error "unexpected configuration - check your compiler defines"
969 #endif
970 #if (LZO_ARCH_ARM_THUMB && !LZO_ARCH_ARM)
971 #  error "unexpected configuration - check your compiler defines"
972 #endif
973 #if (LZO_ARCH_ARM_THUMB1 && !LZO_ARCH_ARM_THUMB)
974 #  error "unexpected configuration - check your compiler defines"
975 #endif
976 #if (LZO_ARCH_ARM_THUMB2 && !LZO_ARCH_ARM_THUMB)
977 #  error "unexpected configuration - check your compiler defines"
978 #endif
979 #if (LZO_ARCH_ARM_THUMB1 && LZO_ARCH_ARM_THUMB2)
980 #  error "unexpected configuration - check your compiler defines"
981 #endif
982 #if (LZO_ARCH_I086PM && !LZO_ARCH_I086)
983 #  error "unexpected configuration - check your compiler defines"
984 #endif
985 #if (LZO_ARCH_I086)
986 #  if (UINT_MAX != LZO_0xffffL)
987 #    error "unexpected configuration - check your compiler defines"
988 #  endif
989 #  if (ULONG_MAX != LZO_0xffffffffL)
990 #    error "unexpected configuration - check your compiler defines"
991 #  endif
992 #endif
993 #if (LZO_ARCH_I386)
994 #  if (UINT_MAX != LZO_0xffffL) && defined(__i386_int16__)
995 #    error "unexpected configuration - check your compiler defines"
996 #  endif
997 #  if (UINT_MAX != LZO_0xffffffffL) && !defined(__i386_int16__)
998 #    error "unexpected configuration - check your compiler defines"
999 #  endif
1000 #  if (ULONG_MAX != LZO_0xffffffffL)
1001 #    error "unexpected configuration - check your compiler defines"
1002 #  endif
1003 #endif
1004 #if (LZO_ARCH_AMD64 || LZO_ARCH_I386)
1005 #  if !defined(LZO_TARGET_FEATURE_SSE2)
1006 #    if defined(__SSE2__)
1007 #      define LZO_TARGET_FEATURE_SSE2       1
1008 #    elif defined(_MSC_VER) && ((defined(_M_IX86_FP) && ((_M_IX86_FP)+0 >= 2)) || defined(_M_AMD64))
1009 #      define LZO_TARGET_FEATURE_SSE2       1
1010 #    endif
1011 #  endif
1012 #  if !defined(LZO_TARGET_FEATURE_SSSE3)
1013 #  if (LZO_TARGET_FEATURE_SSE2)
1014 #    if defined(__SSSE3__)
1015 #      define LZO_TARGET_FEATURE_SSSE3      1
1016 #    elif defined(_MSC_VER) && defined(__AVX__)
1017 #      define LZO_TARGET_FEATURE_SSSE3      1
1018 #    endif
1019 #  endif
1020 #  endif
1021 #  if !defined(LZO_TARGET_FEATURE_SSE4_2)
1022 #  if (LZO_TARGET_FEATURE_SSSE3)
1023 #    if defined(__SSE4_2__)
1024 #      define LZO_TARGET_FEATURE_SSE4_2     1
1025 #    endif
1026 #  endif
1027 #  endif
1028 #  if !defined(LZO_TARGET_FEATURE_AVX)
1029 #  if (LZO_TARGET_FEATURE_SSSE3)
1030 #    if defined(__AVX__)
1031 #      define LZO_TARGET_FEATURE_AVX        1
1032 #    endif
1033 #  endif
1034 #  endif
1035 #  if !defined(LZO_TARGET_FEATURE_AVX2)
1036 #  if (LZO_TARGET_FEATURE_AVX)
1037 #    if defined(__AVX2__)
1038 #      define LZO_TARGET_FEATURE_AVX2       1
1039 #    endif
1040 #  endif
1041 #  endif
1042 #endif
1043 #if (LZO_TARGET_FEATURE_SSSE3 && !(LZO_TARGET_FEATURE_SSE2))
1044 #  error "unexpected configuration - check your compiler defines"
1045 #endif
1046 #if (LZO_TARGET_FEATURE_SSE4_2 && !(LZO_TARGET_FEATURE_SSSE3))
1047 #  error "unexpected configuration - check your compiler defines"
1048 #endif
1049 #if (LZO_TARGET_FEATURE_AVX && !(LZO_TARGET_FEATURE_SSSE3))
1050 #  error "unexpected configuration - check your compiler defines"
1051 #endif
1052 #if (LZO_TARGET_FEATURE_AVX2 && !(LZO_TARGET_FEATURE_AVX))
1053 #  error "unexpected configuration - check your compiler defines"
1054 #endif
1055 #if (LZO_ARCH_ARM)
1056 #  if !defined(LZO_TARGET_FEATURE_NEON)
1057 #    if defined(__ARM_NEON__)
1058 #      define LZO_TARGET_FEATURE_NEON       1
1059 #    endif
1060 #  endif
1061 #elif (LZO_ARCH_ARM64)
1062 #  if !defined(LZO_TARGET_FEATURE_NEON)
1063 #    if 1
1064 #      define LZO_TARGET_FEATURE_NEON       1
1065 #    endif
1066 #  endif
1067 #endif
1068 #if 0
1069 #elif !defined(__LZO_MM_OVERRIDE)
1070 #if (LZO_ARCH_I086)
1071 #if (UINT_MAX != LZO_0xffffL)
1072 #  error "unexpected configuration - check your compiler defines"
1073 #endif
1074 #if defined(__TINY__) || defined(M_I86TM) || defined(_M_I86TM)
1075 #  define LZO_MM_TINY           1
1076 #elif defined(__HUGE__) || defined(_HUGE_) || defined(M_I86HM) || defined(_M_I86HM)
1077 #  define LZO_MM_HUGE           1
1078 #elif defined(__SMALL__) || defined(M_I86SM) || defined(_M_I86SM) || defined(SMALL_MODEL)
1079 #  define LZO_MM_SMALL          1
1080 #elif defined(__MEDIUM__) || defined(M_I86MM) || defined(_M_I86MM)
1081 #  define LZO_MM_MEDIUM         1
1082 #elif defined(__COMPACT__) || defined(M_I86CM) || defined(_M_I86CM)
1083 #  define LZO_MM_COMPACT        1
1084 #elif defined(__LARGE__) || defined(M_I86LM) || defined(_M_I86LM) || defined(LARGE_MODEL)
1085 #  define LZO_MM_LARGE          1
1086 #elif (LZO_CC_AZTECC)
1087 #  if defined(_LARGE_CODE) && defined(_LARGE_DATA)
1088 #    define LZO_MM_LARGE        1
1089 #  elif defined(_LARGE_CODE)
1090 #    define LZO_MM_MEDIUM       1
1091 #  elif defined(_LARGE_DATA)
1092 #    define LZO_MM_COMPACT      1
1093 #  else
1094 #    define LZO_MM_SMALL        1
1095 #  endif
1096 #elif (LZO_CC_ZORTECHC && defined(__VCM__))
1097 #  define LZO_MM_LARGE          1
1098 #else
1099 #  error "unknown LZO_ARCH_I086 memory model"
1100 #endif
1101 #if (LZO_OS_DOS16 || LZO_OS_OS216 || LZO_OS_WIN16)
1102 #define LZO_HAVE_MM_HUGE_PTR        1
1103 #define LZO_HAVE_MM_HUGE_ARRAY      1
1104 #if (LZO_MM_TINY)
1105 #  undef LZO_HAVE_MM_HUGE_ARRAY
1106 #endif
1107 #if (LZO_CC_AZTECC || LZO_CC_PACIFICC || LZO_CC_ZORTECHC)
1108 #  undef LZO_HAVE_MM_HUGE_PTR
1109 #  undef LZO_HAVE_MM_HUGE_ARRAY
1110 #elif (LZO_CC_DMC || LZO_CC_SYMANTECC)
1111 #  undef LZO_HAVE_MM_HUGE_ARRAY
1112 #elif (LZO_CC_MSC && defined(_QC))
1113 #  undef LZO_HAVE_MM_HUGE_ARRAY
1114 #  if (_MSC_VER < 600)
1115 #    undef LZO_HAVE_MM_HUGE_PTR
1116 #  endif
1117 #elif (LZO_CC_TURBOC && (__TURBOC__ < 0x0295))
1118 #  undef LZO_HAVE_MM_HUGE_ARRAY
1119 #endif
1120 #if (LZO_ARCH_I086PM) && !(LZO_HAVE_MM_HUGE_PTR)
1121 #  if (LZO_OS_DOS16)
1122 #    error "unexpected configuration - check your compiler defines"
1123 #  elif (LZO_CC_ZORTECHC)
1124 #  else
1125 #    error "unexpected configuration - check your compiler defines"
1126 #  endif
1127 #endif
1128 #ifdef __cplusplus
1129 extern "C" {
1130 #endif
1131 #if (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0200))
1132    extern void __near __cdecl _AHSHIFT(void);
1133 #  define LZO_MM_AHSHIFT      ((unsigned) _AHSHIFT)
1134 #elif (LZO_CC_DMC || LZO_CC_SYMANTECC || LZO_CC_ZORTECHC)
1135    extern void __near __cdecl _AHSHIFT(void);
1136 #  define LZO_MM_AHSHIFT      ((unsigned) _AHSHIFT)
1137 #elif (LZO_CC_MSC || LZO_CC_TOPSPEEDC)
1138    extern void __near __cdecl _AHSHIFT(void);
1139 #  define LZO_MM_AHSHIFT      ((unsigned) _AHSHIFT)
1140 #elif (LZO_CC_TURBOC && (__TURBOC__ >= 0x0295))
1141    extern void __near __cdecl _AHSHIFT(void);
1142 #  define LZO_MM_AHSHIFT      ((unsigned) _AHSHIFT)
1143 #elif ((LZO_CC_AZTECC || LZO_CC_PACIFICC || LZO_CC_TURBOC) && LZO_OS_DOS16)
1144 #  define LZO_MM_AHSHIFT      12
1145 #elif (LZO_CC_WATCOMC)
1146    extern unsigned char _HShift;
1147 #  define LZO_MM_AHSHIFT      ((unsigned) _HShift)
1148 #else
1149 #  error "FIXME - implement LZO_MM_AHSHIFT"
1150 #endif
1151 #ifdef __cplusplus
1152 }
1153 #endif
1154 #endif
1155 #elif (LZO_ARCH_C166)
1156 #if !defined(__MODEL__)
1157 #  error "FIXME - LZO_ARCH_C166 __MODEL__"
1158 #elif ((__MODEL__) == 0)
1159 #  define LZO_MM_SMALL          1
1160 #elif ((__MODEL__) == 1)
1161 #  define LZO_MM_SMALL          1
1162 #elif ((__MODEL__) == 2)
1163 #  define LZO_MM_LARGE          1
1164 #elif ((__MODEL__) == 3)
1165 #  define LZO_MM_TINY           1
1166 #elif ((__MODEL__) == 4)
1167 #  define LZO_MM_XTINY          1
1168 #elif ((__MODEL__) == 5)
1169 #  define LZO_MM_XSMALL         1
1170 #else
1171 #  error "FIXME - LZO_ARCH_C166 __MODEL__"
1172 #endif
1173 #elif (LZO_ARCH_MCS251)
1174 #if !defined(__MODEL__)
1175 #  error "FIXME - LZO_ARCH_MCS251 __MODEL__"
1176 #elif ((__MODEL__) == 0)
1177 #  define LZO_MM_SMALL          1
1178 #elif ((__MODEL__) == 2)
1179 #  define LZO_MM_LARGE          1
1180 #elif ((__MODEL__) == 3)
1181 #  define LZO_MM_TINY           1
1182 #elif ((__MODEL__) == 4)
1183 #  define LZO_MM_XTINY          1
1184 #elif ((__MODEL__) == 5)
1185 #  define LZO_MM_XSMALL         1
1186 #else
1187 #  error "FIXME - LZO_ARCH_MCS251 __MODEL__"
1188 #endif
1189 #elif (LZO_ARCH_MCS51)
1190 #if !defined(__MODEL__)
1191 #  error "FIXME - LZO_ARCH_MCS51 __MODEL__"
1192 #elif ((__MODEL__) == 1)
1193 #  define LZO_MM_SMALL          1
1194 #elif ((__MODEL__) == 2)
1195 #  define LZO_MM_LARGE          1
1196 #elif ((__MODEL__) == 3)
1197 #  define LZO_MM_TINY           1
1198 #elif ((__MODEL__) == 4)
1199 #  define LZO_MM_XTINY          1
1200 #elif ((__MODEL__) == 5)
1201 #  define LZO_MM_XSMALL         1
1202 #else
1203 #  error "FIXME - LZO_ARCH_MCS51 __MODEL__"
1204 #endif
1205 #elif (LZO_ARCH_CRAY_PVP)
1206 #  define LZO_MM_PVP            1
1207 #else
1208 #  define LZO_MM_FLAT           1
1209 #endif
1210 #if (LZO_MM_COMPACT)
1211 #  define LZO_INFO_MM           "compact"
1212 #elif (LZO_MM_FLAT)
1213 #  define LZO_INFO_MM           "flat"
1214 #elif (LZO_MM_HUGE)
1215 #  define LZO_INFO_MM           "huge"
1216 #elif (LZO_MM_LARGE)
1217 #  define LZO_INFO_MM           "large"
1218 #elif (LZO_MM_MEDIUM)
1219 #  define LZO_INFO_MM           "medium"
1220 #elif (LZO_MM_PVP)
1221 #  define LZO_INFO_MM           "pvp"
1222 #elif (LZO_MM_SMALL)
1223 #  define LZO_INFO_MM           "small"
1224 #elif (LZO_MM_TINY)
1225 #  define LZO_INFO_MM           "tiny"
1226 #else
1227 #  error "unknown memory model"
1228 #endif
1229 #endif
1230 #if !defined(__lzo_gnuc_extension__)
1231 #if (LZO_CC_GNUC >= 0x020800ul)
1232 #  define __lzo_gnuc_extension__    __extension__
1233 #elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE)
1234 #  define __lzo_gnuc_extension__    __extension__
1235 #elif (LZO_CC_IBMC >= 600)
1236 #  define __lzo_gnuc_extension__    __extension__
1237 #else
1238 #endif
1239 #endif
1240 #if !defined(__lzo_gnuc_extension__)
1241 #  define __lzo_gnuc_extension__    /*empty*/
1242 #endif
1243 #if !defined(LZO_CFG_USE_NEW_STYLE_CASTS) && defined(__cplusplus) && 0
1244 #  if (LZO_CC_GNUC && (LZO_CC_GNUC < 0x020800ul))
1245 #    define LZO_CFG_USE_NEW_STYLE_CASTS 0
1246 #  elif (LZO_CC_INTELC && (__INTEL_COMPILER < 1200))
1247 #    define LZO_CFG_USE_NEW_STYLE_CASTS 0
1248 #  else
1249 #    define LZO_CFG_USE_NEW_STYLE_CASTS 1
1250 #  endif
1251 #endif
1252 #if !defined(LZO_CFG_USE_NEW_STYLE_CASTS)
1253 #  define LZO_CFG_USE_NEW_STYLE_CASTS 0
1254 #endif
1255 #if !defined(__cplusplus)
1256 #  if defined(LZO_CFG_USE_NEW_STYLE_CASTS)
1257 #    undef LZO_CFG_USE_NEW_STYLE_CASTS
1258 #  endif
1259 #  define LZO_CFG_USE_NEW_STYLE_CASTS 0
1260 #endif
1261 #if !defined(LZO_REINTERPRET_CAST)
1262 #  if (LZO_CFG_USE_NEW_STYLE_CASTS)
1263 #    define LZO_REINTERPRET_CAST(t,e)       (reinterpret_cast<t> (e))
1264 #  endif
1265 #endif
1266 #if !defined(LZO_REINTERPRET_CAST)
1267 #  define LZO_REINTERPRET_CAST(t,e)         ((t) (e))
1268 #endif
1269 #if !defined(LZO_STATIC_CAST)
1270 #  if (LZO_CFG_USE_NEW_STYLE_CASTS)
1271 #    define LZO_STATIC_CAST(t,e)            (static_cast<t> (e))
1272 #  endif
1273 #endif
1274 #if !defined(LZO_STATIC_CAST)
1275 #  define LZO_STATIC_CAST(t,e)              ((t) (e))
1276 #endif
1277 #if !defined(LZO_STATIC_CAST2)
1278 #  define LZO_STATIC_CAST2(t1,t2,e)         LZO_STATIC_CAST(t1, LZO_STATIC_CAST(t2, e))
1279 #endif
1280 #if !defined(LZO_UNCONST_CAST)
1281 #  if (LZO_CFG_USE_NEW_STYLE_CASTS)
1282 #    define LZO_UNCONST_CAST(t,e)           (const_cast<t> (e))
1283 #  elif (LZO_HAVE_MM_HUGE_PTR)
1284 #    define LZO_UNCONST_CAST(t,e)           ((t) (e))
1285 #  elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE)
1286 #    define LZO_UNCONST_CAST(t,e)           ((t) ((void *) ((lzo_uintptr_t) ((const void *) (e)))))
1287 #  endif
1288 #endif
1289 #if !defined(LZO_UNCONST_CAST)
1290 #  define LZO_UNCONST_CAST(t,e)             ((t) ((void *) ((const void *) (e))))
1291 #endif
1292 #if !defined(LZO_UNCONST_VOLATILE_CAST)
1293 #  if (LZO_CFG_USE_NEW_STYLE_CASTS)
1294 #    define LZO_UNCONST_VOLATILE_CAST(t,e)  (const_cast<t> (e))
1295 #  elif (LZO_HAVE_MM_HUGE_PTR)
1296 #    define LZO_UNCONST_VOLATILE_CAST(t,e)  ((t) (e))
1297 #  elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE)
1298 #    define LZO_UNCONST_VOLATILE_CAST(t,e)  ((t) ((volatile void *) ((lzo_uintptr_t) ((volatile const void *) (e)))))
1299 #  endif
1300 #endif
1301 #if !defined(LZO_UNCONST_VOLATILE_CAST)
1302 #  define LZO_UNCONST_VOLATILE_CAST(t,e)    ((t) ((volatile void *) ((volatile const void *) (e))))
1303 #endif
1304 #if !defined(LZO_UNVOLATILE_CAST)
1305 #  if (LZO_CFG_USE_NEW_STYLE_CASTS)
1306 #    define LZO_UNVOLATILE_CAST(t,e)        (const_cast<t> (e))
1307 #  elif (LZO_HAVE_MM_HUGE_PTR)
1308 #    define LZO_UNVOLATILE_CAST(t,e)        ((t) (e))
1309 #  elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE)
1310 #    define LZO_UNVOLATILE_CAST(t,e)        ((t) ((void *) ((lzo_uintptr_t) ((volatile void *) (e)))))
1311 #  endif
1312 #endif
1313 #if !defined(LZO_UNVOLATILE_CAST)
1314 #  define LZO_UNVOLATILE_CAST(t,e)          ((t) ((void *) ((volatile void *) (e))))
1315 #endif
1316 #if !defined(LZO_UNVOLATILE_CONST_CAST)
1317 #  if (LZO_CFG_USE_NEW_STYLE_CASTS)
1318 #    define LZO_UNVOLATILE_CONST_CAST(t,e)  (const_cast<t> (e))
1319 #  elif (LZO_HAVE_MM_HUGE_PTR)
1320 #    define LZO_UNVOLATILE_CONST_CAST(t,e)  ((t) (e))
1321 #  elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE)
1322 #    define LZO_UNVOLATILE_CONST_CAST(t,e)  ((t) ((const void *) ((lzo_uintptr_t) ((volatile const void *) (e)))))
1323 #  endif
1324 #endif
1325 #if !defined(LZO_UNVOLATILE_CONST_CAST)
1326 #  define LZO_UNVOLATILE_CONST_CAST(t,e)    ((t) ((const void *) ((volatile const void *) (e))))
1327 #endif
1328 #if !defined(LZO_PCAST)
1329 #  if (LZO_HAVE_MM_HUGE_PTR)
1330 #    define LZO_PCAST(t,e)                  ((t) (e))
1331 #  endif
1332 #endif
1333 #if !defined(LZO_PCAST)
1334 #  define LZO_PCAST(t,e)                    LZO_STATIC_CAST(t, LZO_STATIC_CAST(void *, e))
1335 #endif
1336 #if !defined(LZO_CCAST)
1337 #  if (LZO_HAVE_MM_HUGE_PTR)
1338 #    define LZO_CCAST(t,e)                  ((t) (e))
1339 #  endif
1340 #endif
1341 #if !defined(LZO_CCAST)
1342 #  define LZO_CCAST(t,e)                    LZO_STATIC_CAST(t, LZO_STATIC_CAST(const void *, e))
1343 #endif
1344 #if !defined(LZO_ICONV)
1345 #  define LZO_ICONV(t,e)                    LZO_STATIC_CAST(t, e)
1346 #endif
1347 #if !defined(LZO_ICAST)
1348 #  define LZO_ICAST(t,e)                    LZO_STATIC_CAST(t, e)
1349 #endif
1350 #if !defined(LZO_ITRUNC)
1351 #  define LZO_ITRUNC(t,e)                   LZO_STATIC_CAST(t, e)
1352 #endif
1353 #if !defined(__lzo_cte)
1354 #  if (LZO_CC_MSC || LZO_CC_WATCOMC)
1355 #    define __lzo_cte(e)            ((void)0,(e))
1356 #  elif 1
1357 #    define __lzo_cte(e)            ((void)0,(e))
1358 #  endif
1359 #endif
1360 #if !defined(__lzo_cte)
1361 #  define __lzo_cte(e)              (e)
1362 #endif
1363 #if !defined(LZO_BLOCK_BEGIN)
1364 #  define LZO_BLOCK_BEGIN           do {
1365 #  define LZO_BLOCK_END             } while __lzo_cte(0)
1366 #endif
1367 #if !defined(LZO_UNUSED)
1368 #  if (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0600))
1369 #    define LZO_UNUSED(var)         ((void) &var)
1370 #  elif (LZO_CC_BORLANDC || LZO_CC_HIGHC || LZO_CC_NDPC || LZO_CC_PELLESC || LZO_CC_TURBOC)
1371 #    define LZO_UNUSED(var)         if (&var) ; else
1372 #  elif (LZO_CC_CLANG && (LZO_CC_CLANG >= 0x030200ul))
1373 #    define LZO_UNUSED(var)         ((void) &var)
1374 #  elif (LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE)
1375 #    define LZO_UNUSED(var)         ((void) var)
1376 #  elif (LZO_CC_MSC && (_MSC_VER < 900))
1377 #    define LZO_UNUSED(var)         if (&var) ; else
1378 #  elif (LZO_CC_KEILC)
1379 #    define LZO_UNUSED(var)         {LZO_EXTERN_C int lzo_unused__[1-2*!(sizeof(var)>0)];}
1380 #  elif (LZO_CC_PACIFICC)
1381 #    define LZO_UNUSED(var)         ((void) sizeof(var))
1382 #  elif (LZO_CC_WATCOMC) && defined(__cplusplus)
1383 #    define LZO_UNUSED(var)         ((void) var)
1384 #  else
1385 #    define LZO_UNUSED(var)         ((void) &var)
1386 #  endif
1387 #endif
1388 #if !defined(LZO_UNUSED_FUNC)
1389 #  if (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0600))
1390 #    define LZO_UNUSED_FUNC(func)   ((void) func)
1391 #  elif (LZO_CC_BORLANDC || LZO_CC_NDPC || LZO_CC_TURBOC)
1392 #    define LZO_UNUSED_FUNC(func)   if (func) ; else
1393 #  elif (LZO_CC_CLANG || LZO_CC_LLVM)
1394 #    define LZO_UNUSED_FUNC(func)   ((void) &func)
1395 #  elif (LZO_CC_MSC && (_MSC_VER < 900))
1396 #    define LZO_UNUSED_FUNC(func)   if (func) ; else
1397 #  elif (LZO_CC_MSC)
1398 #    define LZO_UNUSED_FUNC(func)   ((void) &func)
1399 #  elif (LZO_CC_KEILC || LZO_CC_PELLESC)
1400 #    define LZO_UNUSED_FUNC(func)   {LZO_EXTERN_C int lzo_unused_func__[1-2*!(sizeof((int)func)>0)];}
1401 #  else
1402 #    define LZO_UNUSED_FUNC(func)   ((void) func)
1403 #  endif
1404 #endif
1405 #if !defined(LZO_UNUSED_LABEL)
1406 #  if (LZO_CC_CLANG >= 0x020800ul)
1407 #    define LZO_UNUSED_LABEL(l)     (__lzo_gnuc_extension__ ((void) ((const void *) &&l)))
1408 #  elif (LZO_CC_ARMCC || LZO_CC_CLANG || LZO_CC_INTELC || LZO_CC_WATCOMC)
1409 #    define LZO_UNUSED_LABEL(l)     if __lzo_cte(0) goto l
1410 #  else
1411 #    define LZO_UNUSED_LABEL(l)     switch (0) case 1:goto l
1412 #  endif
1413 #endif
1414 #if !defined(LZO_DEFINE_UNINITIALIZED_VAR)
1415 #  if 0
1416 #    define LZO_DEFINE_UNINITIALIZED_VAR(type,var,init)  type var
1417 #  elif 0 && (LZO_CC_GNUC)
1418 #    define LZO_DEFINE_UNINITIALIZED_VAR(type,var,init)  type var = var
1419 #  else
1420 #    define LZO_DEFINE_UNINITIALIZED_VAR(type,var,init)  type var = init
1421 #  endif
1422 #endif
1423 #if !defined(__lzo_inline)
1424 #if (LZO_CC_TURBOC && (__TURBOC__ <= 0x0295))
1425 #elif defined(__cplusplus)
1426 #  define __lzo_inline          inline
1427 #elif defined(__STDC_VERSION__) && (__STDC_VERSION__-0 >= 199901L)
1428 #  define __lzo_inline          inline
1429 #elif (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0550))
1430 #  define __lzo_inline          __inline
1431 #elif (LZO_CC_ARMCC_GNUC || LZO_CC_CILLY || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || LZO_CC_PGI)
1432 #  define __lzo_inline          __inline__
1433 #elif (LZO_CC_DMC)
1434 #  define __lzo_inline          __inline
1435 #elif (LZO_CC_GHS)
1436 #  define __lzo_inline          __inline__
1437 #elif (LZO_CC_IBMC >= 600)
1438 #  define __lzo_inline          __inline__
1439 #elif (LZO_CC_INTELC)
1440 #  define __lzo_inline          __inline
1441 #elif (LZO_CC_MWERKS && (__MWERKS__ >= 0x2405))
1442 #  define __lzo_inline          __inline
1443 #elif (LZO_CC_MSC && (_MSC_VER >= 900))
1444 #  define __lzo_inline          __inline
1445 #elif (LZO_CC_SUNPROC >= 0x5100)
1446 #  define __lzo_inline          __inline__
1447 #endif
1448 #endif
1449 #if defined(__lzo_inline)
1450 #  ifndef __lzo_HAVE_inline
1451 #  define __lzo_HAVE_inline 1
1452 #  endif
1453 #else
1454 #  define __lzo_inline          /*empty*/
1455 #endif
1456 #if !defined(__lzo_forceinline)
1457 #if (LZO_CC_GNUC >= 0x030200ul)
1458 #  define __lzo_forceinline     __inline__ __attribute__((__always_inline__))
1459 #elif (LZO_CC_IBMC >= 700)
1460 #  define __lzo_forceinline     __inline__ __attribute__((__always_inline__))
1461 #elif (LZO_CC_INTELC_MSC && (__INTEL_COMPILER >= 450))
1462 #  define __lzo_forceinline     __forceinline
1463 #elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 800))
1464 #  define __lzo_forceinline     __inline__ __attribute__((__always_inline__))
1465 #elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE)
1466 #  define __lzo_forceinline     __inline__ __attribute__((__always_inline__))
1467 #elif (LZO_CC_MSC && (_MSC_VER >= 1200))
1468 #  define __lzo_forceinline     __forceinline
1469 #elif (LZO_CC_PGI >= 0x0d0a00ul)
1470 #  define __lzo_forceinline     __inline__ __attribute__((__always_inline__))
1471 #elif (LZO_CC_SUNPROC >= 0x5100)
1472 #  define __lzo_forceinline     __inline__ __attribute__((__always_inline__))
1473 #endif
1474 #endif
1475 #if defined(__lzo_forceinline)
1476 #  ifndef __lzo_HAVE_forceinline
1477 #  define __lzo_HAVE_forceinline 1
1478 #  endif
1479 #else
1480 #  define __lzo_forceinline     __lzo_inline
1481 #endif
1482 #if !defined(__lzo_noinline)
1483 #if 1 && (LZO_ARCH_I386) && (LZO_CC_GNUC >= 0x040000ul) && (LZO_CC_GNUC < 0x040003ul)
1484 #  define __lzo_noinline        __attribute__((__noinline__,__used__))
1485 #elif (LZO_CC_GNUC >= 0x030200ul)
1486 #  define __lzo_noinline        __attribute__((__noinline__))
1487 #elif (LZO_CC_IBMC >= 700)
1488 #  define __lzo_noinline        __attribute__((__noinline__))
1489 #elif (LZO_CC_INTELC_MSC && (__INTEL_COMPILER >= 600))
1490 #  define __lzo_noinline        __declspec(noinline)
1491 #elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 800))
1492 #  define __lzo_noinline        __attribute__((__noinline__))
1493 #elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE)
1494 #  define __lzo_noinline        __attribute__((__noinline__))
1495 #elif (LZO_CC_MSC && (_MSC_VER >= 1300))
1496 #  define __lzo_noinline        __declspec(noinline)
1497 #elif (LZO_CC_MWERKS && (__MWERKS__ >= 0x3200) && (LZO_OS_WIN32 || LZO_OS_WIN64))
1498 #  if defined(__cplusplus)
1499 #  else
1500 #    define __lzo_noinline      __declspec(noinline)
1501 #  endif
1502 #elif (LZO_CC_PGI >= 0x0d0a00ul)
1503 #  define __lzo_noinline        __attribute__((__noinline__))
1504 #elif (LZO_CC_SUNPROC >= 0x5100)
1505 #  define __lzo_noinline        __attribute__((__noinline__))
1506 #endif
1507 #endif
1508 #if defined(__lzo_noinline)
1509 #  ifndef __lzo_HAVE_noinline
1510 #  define __lzo_HAVE_noinline 1
1511 #  endif
1512 #else
1513 #  define __lzo_noinline        /*empty*/
1514 #endif
1515 #if (__lzo_HAVE_forceinline || __lzo_HAVE_noinline) && !(__lzo_HAVE_inline)
1516 #  error "unexpected configuration - check your compiler defines"
1517 #endif
1518 #if !defined(__lzo_static_inline)
1519 #if (LZO_CC_IBMC)
1520 #  define __lzo_static_inline       __lzo_gnuc_extension__ static __lzo_inline
1521 #endif
1522 #endif
1523 #if !defined(__lzo_static_inline)
1524 #  define __lzo_static_inline       static __lzo_inline
1525 #endif
1526 #if !defined(__lzo_static_forceinline)
1527 #if (LZO_CC_IBMC)
1528 #  define __lzo_static_forceinline  __lzo_gnuc_extension__ static __lzo_forceinline
1529 #endif
1530 #endif
1531 #if !defined(__lzo_static_forceinline)
1532 #  define __lzo_static_forceinline  static __lzo_forceinline
1533 #endif
1534 #if !defined(__lzo_static_noinline)
1535 #if (LZO_CC_IBMC)
1536 #  define __lzo_static_noinline     __lzo_gnuc_extension__ static __lzo_noinline
1537 #endif
1538 #endif
1539 #if !defined(__lzo_static_noinline)
1540 #  define __lzo_static_noinline     static __lzo_noinline
1541 #endif
1542 #if !defined(__lzo_c99_extern_inline)
1543 #if defined(__GNUC_GNU_INLINE__)
1544 #  define __lzo_c99_extern_inline   __lzo_inline
1545 #elif defined(__GNUC_STDC_INLINE__)
1546 #  define __lzo_c99_extern_inline   extern __lzo_inline
1547 #elif defined(__STDC_VERSION__) && (__STDC_VERSION__-0 >= 199901L)
1548 #  define __lzo_c99_extern_inline   extern __lzo_inline
1549 #endif
1550 #if !defined(__lzo_c99_extern_inline) && (__lzo_HAVE_inline)
1551 #  define __lzo_c99_extern_inline   __lzo_inline
1552 #endif
1553 #endif
1554 #if defined(__lzo_c99_extern_inline)
1555 #  ifndef __lzo_HAVE_c99_extern_inline
1556 #  define __lzo_HAVE_c99_extern_inline 1
1557 #  endif
1558 #else
1559 #  define __lzo_c99_extern_inline   /*empty*/
1560 #endif
1561 #if !defined(__lzo_may_alias)
1562 #if (LZO_CC_GNUC >= 0x030400ul)
1563 #  define __lzo_may_alias       __attribute__((__may_alias__))
1564 #elif (LZO_CC_CLANG >= 0x020900ul)
1565 #  define __lzo_may_alias       __attribute__((__may_alias__))
1566 #elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 1210)) && 0
1567 #  define __lzo_may_alias       __attribute__((__may_alias__))
1568 #elif (LZO_CC_PGI >= 0x0d0a00ul) && 0
1569 #  define __lzo_may_alias       __attribute__((__may_alias__))
1570 #endif
1571 #endif
1572 #if defined(__lzo_may_alias)
1573 #  ifndef __lzo_HAVE_may_alias
1574 #  define __lzo_HAVE_may_alias 1
1575 #  endif
1576 #else
1577 #  define __lzo_may_alias       /*empty*/
1578 #endif
1579 #if !defined(__lzo_noreturn)
1580 #if (LZO_CC_GNUC >= 0x020700ul)
1581 #  define __lzo_noreturn        __attribute__((__noreturn__))
1582 #elif (LZO_CC_IBMC >= 700)
1583 #  define __lzo_noreturn        __attribute__((__noreturn__))
1584 #elif (LZO_CC_INTELC_MSC && (__INTEL_COMPILER >= 450))
1585 #  define __lzo_noreturn        __declspec(noreturn)
1586 #elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 600))
1587 #  define __lzo_noreturn        __attribute__((__noreturn__))
1588 #elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE)
1589 #  define __lzo_noreturn        __attribute__((__noreturn__))
1590 #elif (LZO_CC_MSC && (_MSC_VER >= 1200))
1591 #  define __lzo_noreturn        __declspec(noreturn)
1592 #elif (LZO_CC_PGI >= 0x0d0a00ul)
1593 #  define __lzo_noreturn        __attribute__((__noreturn__))
1594 #endif
1595 #endif
1596 #if defined(__lzo_noreturn)
1597 #  ifndef __lzo_HAVE_noreturn
1598 #  define __lzo_HAVE_noreturn 1
1599 #  endif
1600 #else
1601 #  define __lzo_noreturn        /*empty*/
1602 #endif
1603 #if !defined(__lzo_nothrow)
1604 #if (LZO_CC_GNUC >= 0x030300ul)
1605 #  define __lzo_nothrow         __attribute__((__nothrow__))
1606 #elif (LZO_CC_INTELC_MSC && (__INTEL_COMPILER >= 450)) && defined(__cplusplus)
1607 #  define __lzo_nothrow         __declspec(nothrow)
1608 #elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 900))
1609 #  define __lzo_nothrow         __attribute__((__nothrow__))
1610 #elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE)
1611 #  define __lzo_nothrow         __attribute__((__nothrow__))
1612 #elif (LZO_CC_MSC && (_MSC_VER >= 1200)) && defined(__cplusplus)
1613 #  define __lzo_nothrow         __declspec(nothrow)
1614 #endif
1615 #endif
1616 #if defined(__lzo_nothrow)
1617 #  ifndef __lzo_HAVE_nothrow
1618 #  define __lzo_HAVE_nothrow 1
1619 #  endif
1620 #else
1621 #  define __lzo_nothrow         /*empty*/
1622 #endif
1623 #if !defined(__lzo_restrict)
1624 #if (LZO_CC_GNUC >= 0x030400ul)
1625 #  define __lzo_restrict        __restrict__
1626 #elif (LZO_CC_IBMC >= 800) && !defined(__cplusplus)
1627 #  define __lzo_restrict        __restrict__
1628 #elif (LZO_CC_IBMC >= 1210)
1629 #  define __lzo_restrict        __restrict__
1630 #elif (LZO_CC_INTELC_MSC && (__INTEL_COMPILER >= 600))
1631 #elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 600))
1632 #  define __lzo_restrict        __restrict__
1633 #elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM)
1634 #  define __lzo_restrict        __restrict__
1635 #elif (LZO_CC_MSC && (_MSC_VER >= 1400))
1636 #  define __lzo_restrict        __restrict
1637 #elif (LZO_CC_PGI >= 0x0d0a00ul)
1638 #  define __lzo_restrict        __restrict__
1639 #endif
1640 #endif
1641 #if defined(__lzo_restrict)
1642 #  ifndef __lzo_HAVE_restrict
1643 #  define __lzo_HAVE_restrict 1
1644 #  endif
1645 #else
1646 #  define __lzo_restrict        /*empty*/
1647 #endif
1648 #if !defined(__lzo_alignof)
1649 #if (LZO_CC_ARMCC || LZO_CC_CILLY || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || LZO_CC_PGI)
1650 #  define __lzo_alignof(e)      __alignof__(e)
1651 #elif (LZO_CC_GHS) && !defined(__cplusplus)
1652 #  define __lzo_alignof(e)      __alignof__(e)
1653 #elif (LZO_CC_IBMC >= 600)
1654 #  define __lzo_alignof(e)      (__lzo_gnuc_extension__ __alignof__(e))
1655 #elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 700))
1656 #  define __lzo_alignof(e)      __alignof__(e)
1657 #elif (LZO_CC_MSC && (_MSC_VER >= 1300))
1658 #  define __lzo_alignof(e)      __alignof(e)
1659 #elif (LZO_CC_SUNPROC >= 0x5100)
1660 #  define __lzo_alignof(e)      __alignof__(e)
1661 #endif
1662 #endif
1663 #if defined(__lzo_alignof)
1664 #  ifndef __lzo_HAVE_alignof
1665 #  define __lzo_HAVE_alignof 1
1666 #  endif
1667 #endif
1668 #if !defined(__lzo_struct_packed)
1669 #if   (LZO_CC_CLANG && (LZO_CC_CLANG < 0x020800ul)) && defined(__cplusplus)
1670 #elif (LZO_CC_GNUC && (LZO_CC_GNUC < 0x020700ul))
1671 #elif (LZO_CC_GNUC && (LZO_CC_GNUC < 0x020800ul)) && defined(__cplusplus)
1672 #elif (LZO_CC_PCC && (LZO_CC_PCC < 0x010100ul))
1673 #elif (LZO_CC_SUNPROC && (LZO_CC_SUNPROC < 0x5110)) && !defined(__cplusplus)
1674 #elif (LZO_CC_GNUC >= 0x030400ul) && !(LZO_CC_PCC_GNUC) && (LZO_ARCH_AMD64 || LZO_ARCH_I386)
1675 #  define __lzo_struct_packed(s)        struct s {
1676 #  define __lzo_struct_packed_end()     } __attribute__((__gcc_struct__,__packed__));
1677 #  define __lzo_struct_packed_ma_end()  } __lzo_may_alias __attribute__((__gcc_struct__,__packed__));
1678 #elif (LZO_CC_ARMCC || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_INTELC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || (LZO_CC_PGI >= 0x0d0a00ul) || (LZO_CC_SUNPROC >= 0x5100))
1679 #  define __lzo_struct_packed(s)        struct s {
1680 #  define __lzo_struct_packed_end()     } __attribute__((__packed__));
1681 #  define __lzo_struct_packed_ma_end()  } __lzo_may_alias __attribute__((__packed__));
1682 #elif (LZO_CC_IBMC >= 700)
1683 #  define __lzo_struct_packed(s)        __lzo_gnuc_extension__ struct s {
1684 #  define __lzo_struct_packed_end()     } __attribute__((__packed__));
1685 #  define __lzo_struct_packed_ma_end()  } __lzo_may_alias __attribute__((__packed__));
1686 #elif (LZO_CC_INTELC_MSC) || (LZO_CC_MSC && (_MSC_VER >= 1300))
1687 #  define __lzo_struct_packed(s)        __pragma(pack(push,1)) struct s {
1688 #  define __lzo_struct_packed_end()     } __pragma(pack(pop));
1689 #elif (LZO_CC_WATCOMC && (__WATCOMC__ >= 900))
1690 #  define __lzo_struct_packed(s)        _Packed struct s {
1691 #  define __lzo_struct_packed_end()     };
1692 #endif
1693 #endif
1694 #if defined(__lzo_struct_packed) && !defined(__lzo_struct_packed_ma)
1695 #  define __lzo_struct_packed_ma(s)     __lzo_struct_packed(s)
1696 #endif
1697 #if defined(__lzo_struct_packed_end) && !defined(__lzo_struct_packed_ma_end)
1698 #  define __lzo_struct_packed_ma_end()  __lzo_struct_packed_end()
1699 #endif
1700 #if !defined(__lzo_byte_struct)
1701 #if defined(__lzo_struct_packed)
1702 #  define __lzo_byte_struct(s,n)        __lzo_struct_packed(s) unsigned char a[n]; __lzo_struct_packed_end()
1703 #  define __lzo_byte_struct_ma(s,n)     __lzo_struct_packed_ma(s) unsigned char a[n]; __lzo_struct_packed_ma_end()
1704 #elif (LZO_CC_CILLY || LZO_CC_CLANG || LZO_CC_PGI || (LZO_CC_SUNPROC >= 0x5100))
1705 #  define __lzo_byte_struct(s,n)        struct s { unsigned char a[n]; } __attribute__((__packed__));
1706 #  define __lzo_byte_struct_ma(s,n)     struct s { unsigned char a[n]; } __lzo_may_alias __attribute__((__packed__));
1707 #endif
1708 #endif
1709 #if defined(__lzo_byte_struct) &&  !defined(__lzo_byte_struct_ma)
1710 #  define __lzo_byte_struct_ma(s,n)     __lzo_byte_struct(s,n)
1711 #endif
1712 #if !defined(__lzo_struct_align16) && (__lzo_HAVE_alignof)
1713 #if (LZO_CC_GNUC && (LZO_CC_GNUC < 0x030000ul))
1714 #elif (LZO_CC_CLANG && (LZO_CC_CLANG < 0x020800ul)) && defined(__cplusplus)
1715 #elif (LZO_CC_CILLY || LZO_CC_PCC)
1716 #elif (LZO_CC_INTELC_MSC) || (LZO_CC_MSC && (_MSC_VER >= 1300))
1717 #  define __lzo_struct_align16(s)       struct __declspec(align(16)) s {
1718 #  define __lzo_struct_align16_end()    };
1719 #  define __lzo_struct_align32(s)       struct __declspec(align(32)) s {
1720 #  define __lzo_struct_align32_end()    };
1721 #  define __lzo_struct_align64(s)       struct __declspec(align(64)) s {
1722 #  define __lzo_struct_align64_end()    };
1723 #elif (LZO_CC_ARMCC || LZO_CC_CLANG || LZO_CC_GNUC || (LZO_CC_IBMC >= 700) || LZO_CC_INTELC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE)
1724 #  define __lzo_struct_align16(s)       struct s {
1725 #  define __lzo_struct_align16_end()    } __attribute__((__aligned__(16)));
1726 #  define __lzo_struct_align32(s)       struct s {
1727 #  define __lzo_struct_align32_end()    } __attribute__((__aligned__(32)));
1728 #  define __lzo_struct_align64(s)       struct s {
1729 #  define __lzo_struct_align64_end()    } __attribute__((__aligned__(64)));
1730 #endif
1731 #endif
1732 #if !defined(__lzo_union_um)
1733 #if   (LZO_CC_CLANG && (LZO_CC_CLANG < 0x020800ul)) && defined(__cplusplus)
1734 #elif (LZO_CC_GNUC && (LZO_CC_GNUC < 0x020700ul))
1735 #elif (LZO_CC_GNUC && (LZO_CC_GNUC < 0x020800ul)) && defined(__cplusplus)
1736 #elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER < 810))
1737 #elif (LZO_CC_PCC && (LZO_CC_PCC < 0x010100ul))
1738 #elif (LZO_CC_SUNPROC && (LZO_CC_SUNPROC < 0x5110)) && !defined(__cplusplus)
1739 #elif (LZO_CC_ARMCC || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_INTELC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || (LZO_CC_PGI >= 0x0d0a00ul) || (LZO_CC_SUNPROC >= 0x5100))
1740 #  define __lzo_union_am(s)             union s {
1741 #  define __lzo_union_am_end()          } __lzo_may_alias;
1742 #  define __lzo_union_um(s)             union s {
1743 #  define __lzo_union_um_end()          } __lzo_may_alias __attribute__((__packed__));
1744 #elif (LZO_CC_IBMC >= 700)
1745 #  define __lzo_union_am(s)             __lzo_gnuc_extension__ union s {
1746 #  define __lzo_union_am_end()          } __lzo_may_alias;
1747 #  define __lzo_union_um(s)             __lzo_gnuc_extension__ union s {
1748 #  define __lzo_union_um_end()          } __lzo_may_alias __attribute__((__packed__));
1749 #elif (LZO_CC_INTELC_MSC) || (LZO_CC_MSC && (_MSC_VER >= 1300))
1750 #  define __lzo_union_um(s)             __pragma(pack(push,1)) union s {
1751 #  define __lzo_union_um_end()          } __pragma(pack(pop));
1752 #elif (LZO_CC_WATCOMC && (__WATCOMC__ >= 900))
1753 #  define __lzo_union_um(s)             _Packed union s {
1754 #  define __lzo_union_um_end()          };
1755 #endif
1756 #endif
1757 #if !defined(__lzo_union_am)
1758 #  define __lzo_union_am(s)             union s {
1759 #  define __lzo_union_am_end()          };
1760 #endif
1761 #if !defined(__lzo_constructor)
1762 #if (LZO_CC_GNUC >= 0x030400ul)
1763 #  define __lzo_constructor     __attribute__((__constructor__,__used__))
1764 #elif (LZO_CC_GNUC >= 0x020700ul)
1765 #  define __lzo_constructor     __attribute__((__constructor__))
1766 #elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 800))
1767 #  define __lzo_constructor     __attribute__((__constructor__,__used__))
1768 #elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE)
1769 #  define __lzo_constructor     __attribute__((__constructor__))
1770 #endif
1771 #endif
1772 #if defined(__lzo_constructor)
1773 #  ifndef __lzo_HAVE_constructor
1774 #  define __lzo_HAVE_constructor 1
1775 #  endif
1776 #endif
1777 #if !defined(__lzo_destructor)
1778 #if (LZO_CC_GNUC >= 0x030400ul)
1779 #  define __lzo_destructor      __attribute__((__destructor__,__used__))
1780 #elif (LZO_CC_GNUC >= 0x020700ul)
1781 #  define __lzo_destructor      __attribute__((__destructor__))
1782 #elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 800))
1783 #  define __lzo_destructor      __attribute__((__destructor__,__used__))
1784 #elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE)
1785 #  define __lzo_destructor      __attribute__((__destructor__))
1786 #endif
1787 #endif
1788 #if defined(__lzo_destructor)
1789 #  ifndef __lzo_HAVE_destructor
1790 #  define __lzo_HAVE_destructor 1
1791 #  endif
1792 #endif
1793 #if (__lzo_HAVE_destructor) && !(__lzo_HAVE_constructor)
1794 #  error "unexpected configuration - check your compiler defines"
1795 #endif
1796 #if !defined(__lzo_likely) && !defined(__lzo_unlikely)
1797 #if (LZO_CC_GNUC >= 0x030200ul)
1798 #  define __lzo_likely(e)       (__builtin_expect(!!(e),1))
1799 #  define __lzo_unlikely(e)     (__builtin_expect(!!(e),0))
1800 #elif (LZO_CC_IBMC >= 1010)
1801 #  define __lzo_likely(e)       (__builtin_expect(!!(e),1))
1802 #  define __lzo_unlikely(e)     (__builtin_expect(!!(e),0))
1803 #elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 800))
1804 #  define __lzo_likely(e)       (__builtin_expect(!!(e),1))
1805 #  define __lzo_unlikely(e)     (__builtin_expect(!!(e),0))
1806 #elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE)
1807 #  define __lzo_likely(e)       (__builtin_expect(!!(e),1))
1808 #  define __lzo_unlikely(e)     (__builtin_expect(!!(e),0))
1809 #endif
1810 #endif
1811 #if defined(__lzo_likely)
1812 #  ifndef __lzo_HAVE_likely
1813 #  define __lzo_HAVE_likely 1
1814 #  endif
1815 #else
1816 #  define __lzo_likely(e)       (e)
1817 #endif
1818 #if defined(__lzo_unlikely)
1819 #  ifndef __lzo_HAVE_unlikely
1820 #  define __lzo_HAVE_unlikely 1
1821 #  endif
1822 #else
1823 #  define __lzo_unlikely(e)     (e)
1824 #endif
1825 #if !defined(__lzo_static_unused_void_func)
1826 #  if 1 && (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || (LZO_CC_GNUC >= 0x020700ul) || LZO_CC_INTELC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || LZO_CC_PGI)
1827 #    define __lzo_static_unused_void_func(f)    static void __attribute__((__unused__)) f(void)
1828 #  else
1829 #    define __lzo_static_unused_void_func(f)    static __lzo_inline void f(void)
1830 #  endif
1831 #endif
1832 #if !defined(__lzo_loop_forever)
1833 #  if (LZO_CC_IBMC)
1834 #    define __lzo_loop_forever()    LZO_BLOCK_BEGIN for (;;) { ; } LZO_BLOCK_END
1835 #  else
1836 #    define __lzo_loop_forever()    do { ; } while __lzo_cte(1)
1837 #  endif
1838 #endif
1839 #if !defined(__lzo_unreachable)
1840 #if (LZO_CC_CLANG && (LZO_CC_CLANG >= 0x020800ul))
1841 #  define __lzo_unreachable()       __builtin_unreachable();
1842 #elif (LZO_CC_GNUC >= 0x040500ul)
1843 #  define __lzo_unreachable()       __builtin_unreachable();
1844 #elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 1300)) && 1
1845 #  define __lzo_unreachable()       __builtin_unreachable();
1846 #endif
1847 #endif
1848 #if defined(__lzo_unreachable)
1849 #  ifndef __lzo_HAVE_unreachable
1850 #  define __lzo_HAVE_unreachable 1
1851 #  endif
1852 #else
1853 #  if 0
1854 #  define __lzo_unreachable()       ((void)0);
1855 #  else
1856 #  define __lzo_unreachable()       __lzo_loop_forever();
1857 #  endif
1858 #endif
1859 #ifndef __LZO_CTA_NAME
1860 #if (LZO_CFG_USE_COUNTER)
1861 #  define __LZO_CTA_NAME(a)         LZO_PP_ECONCAT2(a,__COUNTER__)
1862 #else
1863 #  define __LZO_CTA_NAME(a)         LZO_PP_ECONCAT2(a,__LINE__)
1864 #endif
1865 #endif
1866 #if !defined(LZO_COMPILE_TIME_ASSERT_HEADER)
1867 #  if (LZO_CC_AZTECC || LZO_CC_ZORTECHC)
1868 #    define LZO_COMPILE_TIME_ASSERT_HEADER(e)  LZO_EXTERN_C_BEGIN extern int __LZO_CTA_NAME(lzo_cta__)[1-!(e)]; LZO_EXTERN_C_END
1869 #  elif (LZO_CC_DMC || LZO_CC_SYMANTECC)
1870 #    define LZO_COMPILE_TIME_ASSERT_HEADER(e)  LZO_EXTERN_C_BEGIN extern int __LZO_CTA_NAME(lzo_cta__)[1u-2*!(e)]; LZO_EXTERN_C_END
1871 #  elif (LZO_CC_TURBOC && (__TURBOC__ == 0x0295))
1872 #    define LZO_COMPILE_TIME_ASSERT_HEADER(e)  LZO_EXTERN_C_BEGIN extern int __LZO_CTA_NAME(lzo_cta__)[1-!(e)]; LZO_EXTERN_C_END
1873 #  elif (LZO_CC_CLANG && (LZO_CC_CLANG < 0x020900ul)) && defined(__cplusplus)
1874 #    define LZO_COMPILE_TIME_ASSERT_HEADER(e)  LZO_EXTERN_C_BEGIN int __LZO_CTA_NAME(lzo_cta_f__)(int [1-2*!(e)]); LZO_EXTERN_C_END
1875 #  elif (LZO_CC_GNUC) && defined(__CHECKER__) && defined(__SPARSE_CHECKER__)
1876 #    define LZO_COMPILE_TIME_ASSERT_HEADER(e)  LZO_EXTERN_C_BEGIN enum {__LZO_CTA_NAME(lzo_cta_e__)=1/!!(e)} __attribute__((__unused__)); LZO_EXTERN_C_END
1877 #  else
1878 #    define LZO_COMPILE_TIME_ASSERT_HEADER(e)  LZO_EXTERN_C_BEGIN extern int __LZO_CTA_NAME(lzo_cta__)[1-2*!(e)]; LZO_EXTERN_C_END
1879 #  endif
1880 #endif
1881 #if !defined(LZO_COMPILE_TIME_ASSERT)
1882 #  if (LZO_CC_AZTECC)
1883 #    define LZO_COMPILE_TIME_ASSERT(e)  {typedef int __LZO_CTA_NAME(lzo_cta_t__)[1-!(e)];}
1884 #  elif (LZO_CC_DMC || LZO_CC_PACIFICC || LZO_CC_SYMANTECC || LZO_CC_ZORTECHC)
1885 #    define LZO_COMPILE_TIME_ASSERT(e)  switch(0) case 1:case !(e):break;
1886 #  elif (LZO_CC_GNUC) && defined(__CHECKER__) && defined(__SPARSE_CHECKER__)
1887 #    define LZO_COMPILE_TIME_ASSERT(e)  {(void) (0/!!(e));}
1888 #  elif (LZO_CC_GNUC >= 0x040700ul) && (LZO_CFG_USE_COUNTER) && defined(__cplusplus)
1889 #    define LZO_COMPILE_TIME_ASSERT(e)  {enum {__LZO_CTA_NAME(lzo_cta_e__)=1/!!(e)} __attribute__((__unused__));}
1890 #  elif (LZO_CC_GNUC >= 0x040700ul)
1891 #    define LZO_COMPILE_TIME_ASSERT(e)  {typedef int __LZO_CTA_NAME(lzo_cta_t__)[1-2*!(e)] __attribute__((__unused__));}
1892 #  elif (LZO_CC_MSC && (_MSC_VER < 900))
1893 #    define LZO_COMPILE_TIME_ASSERT(e)  switch(0) case 1:case !(e):break;
1894 #  elif (LZO_CC_TURBOC && (__TURBOC__ == 0x0295))
1895 #    define LZO_COMPILE_TIME_ASSERT(e)  switch(0) case 1:case !(e):break;
1896 #  else
1897 #    define LZO_COMPILE_TIME_ASSERT(e)  {typedef int __LZO_CTA_NAME(lzo_cta_t__)[1-2*!(e)];}
1898 #  endif
1899 #endif
1900 LZO_COMPILE_TIME_ASSERT_HEADER(1 == 1)
1901 #if defined(__cplusplus)
1902 extern "C" { LZO_COMPILE_TIME_ASSERT_HEADER(2 == 2) }
1903 #endif
1904 LZO_COMPILE_TIME_ASSERT_HEADER(3 == 3)
1905 #if (LZO_ARCH_I086 || LZO_ARCH_I386) && (LZO_OS_DOS16 || LZO_OS_DOS32 || LZO_OS_OS2 || LZO_OS_OS216 || LZO_OS_WIN16 || LZO_OS_WIN32 || LZO_OS_WIN64)
1906 #  if (LZO_CC_GNUC || LZO_CC_HIGHC || LZO_CC_NDPC || LZO_CC_PACIFICC)
1907 #  elif (LZO_CC_DMC || LZO_CC_SYMANTECC || LZO_CC_ZORTECHC)
1908 #    define __lzo_cdecl                 __cdecl
1909 #    define __lzo_cdecl_atexit          /*empty*/
1910 #    define __lzo_cdecl_main            __cdecl
1911 #    if (LZO_OS_OS2 && (LZO_CC_DMC || LZO_CC_SYMANTECC))
1912 #      define __lzo_cdecl_qsort         __pascal
1913 #    elif (LZO_OS_OS2 && (LZO_CC_ZORTECHC))
1914 #      define __lzo_cdecl_qsort         _stdcall
1915 #    else
1916 #      define __lzo_cdecl_qsort         __cdecl
1917 #    endif
1918 #  elif (LZO_CC_WATCOMC)
1919 #    define __lzo_cdecl                 __cdecl
1920 #  else
1921 #    define __lzo_cdecl                 __cdecl
1922 #    define __lzo_cdecl_atexit          __cdecl
1923 #    define __lzo_cdecl_main            __cdecl
1924 #    define __lzo_cdecl_qsort           __cdecl
1925 #  endif
1926 #  if (LZO_CC_GNUC || LZO_CC_HIGHC || LZO_CC_NDPC || LZO_CC_PACIFICC || LZO_CC_WATCOMC)
1927 #  elif (LZO_OS_OS2 && (LZO_CC_DMC || LZO_CC_SYMANTECC))
1928 #    define __lzo_cdecl_sighandler      __pascal
1929 #  elif (LZO_OS_OS2 && (LZO_CC_ZORTECHC))
1930 #    define __lzo_cdecl_sighandler      _stdcall
1931 #  elif (LZO_CC_MSC && (_MSC_VER >= 1400)) && defined(_M_CEE_PURE)
1932 #    define __lzo_cdecl_sighandler      __clrcall
1933 #  elif (LZO_CC_MSC && (_MSC_VER >= 600 && _MSC_VER < 700))
1934 #    if defined(_DLL)
1935 #      define __lzo_cdecl_sighandler    _far _cdecl _loadds
1936 #    elif defined(_MT)
1937 #      define __lzo_cdecl_sighandler    _far _cdecl
1938 #    else
1939 #      define __lzo_cdecl_sighandler    _cdecl
1940 #    endif
1941 #  else
1942 #    define __lzo_cdecl_sighandler      __cdecl
1943 #  endif
1944 #elif (LZO_ARCH_I386) && (LZO_CC_WATCOMC)
1945 #  define __lzo_cdecl                   __cdecl
1946 #elif (LZO_ARCH_M68K && LZO_OS_TOS && (LZO_CC_PUREC || LZO_CC_TURBOC))
1947 #  define __lzo_cdecl                   cdecl
1948 #endif
1949 #if !defined(__lzo_cdecl)
1950 #  define __lzo_cdecl                   /*empty*/
1951 #endif
1952 #if !defined(__lzo_cdecl_atexit)
1953 #  define __lzo_cdecl_atexit            /*empty*/
1954 #endif
1955 #if !defined(__lzo_cdecl_main)
1956 #  define __lzo_cdecl_main              /*empty*/
1957 #endif
1958 #if !defined(__lzo_cdecl_qsort)
1959 #  define __lzo_cdecl_qsort             /*empty*/
1960 #endif
1961 #if !defined(__lzo_cdecl_sighandler)
1962 #  define __lzo_cdecl_sighandler        /*empty*/
1963 #endif
1964 #if !defined(__lzo_cdecl_va)
1965 #  define __lzo_cdecl_va                __lzo_cdecl
1966 #endif
1967 #if !(LZO_CFG_NO_WINDOWS_H)
1968 #if !defined(LZO_HAVE_WINDOWS_H)
1969 #if (LZO_OS_CYGWIN || (LZO_OS_EMX && defined(__RSXNT__)) || LZO_OS_WIN32 || LZO_OS_WIN64)
1970 #  if (LZO_CC_WATCOMC && (__WATCOMC__ < 1000))
1971 #  elif (LZO_OS_WIN32 && LZO_CC_GNUC) && defined(__PW32__)
1972 #  elif ((LZO_OS_CYGWIN || defined(__MINGW32__)) && (LZO_CC_GNUC && (LZO_CC_GNUC < 0x025f00ul)))
1973 #  else
1974 #    define LZO_HAVE_WINDOWS_H 1
1975 #  endif
1976 #endif
1977 #endif
1978 #endif
1979 #ifndef LZO_SIZEOF_SHORT
1980 #if defined(SIZEOF_SHORT)
1981 #  define LZO_SIZEOF_SHORT          (SIZEOF_SHORT)
1982 #elif defined(__SIZEOF_SHORT__)
1983 #  define LZO_SIZEOF_SHORT          (__SIZEOF_SHORT__)
1984 #endif
1985 #endif
1986 #ifndef LZO_SIZEOF_INT
1987 #if defined(SIZEOF_INT)
1988 #  define LZO_SIZEOF_INT            (SIZEOF_INT)
1989 #elif defined(__SIZEOF_INT__)
1990 #  define LZO_SIZEOF_INT            (__SIZEOF_INT__)
1991 #endif
1992 #endif
1993 #ifndef LZO_SIZEOF_LONG
1994 #if defined(SIZEOF_LONG)
1995 #  define LZO_SIZEOF_LONG           (SIZEOF_LONG)
1996 #elif defined(__SIZEOF_LONG__)
1997 #  define LZO_SIZEOF_LONG           (__SIZEOF_LONG__)
1998 #endif
1999 #endif
2000 #ifndef LZO_SIZEOF_LONG_LONG
2001 #if defined(SIZEOF_LONG_LONG)
2002 #  define LZO_SIZEOF_LONG_LONG      (SIZEOF_LONG_LONG)
2003 #elif defined(__SIZEOF_LONG_LONG__)
2004 #  define LZO_SIZEOF_LONG_LONG      (__SIZEOF_LONG_LONG__)
2005 #endif
2006 #endif
2007 #ifndef LZO_SIZEOF___INT16
2008 #if defined(SIZEOF___INT16)
2009 #  define LZO_SIZEOF___INT16        (SIZEOF___INT16)
2010 #endif
2011 #endif
2012 #ifndef LZO_SIZEOF___INT32
2013 #if defined(SIZEOF___INT32)
2014 #  define LZO_SIZEOF___INT32        (SIZEOF___INT32)
2015 #endif
2016 #endif
2017 #ifndef LZO_SIZEOF___INT64
2018 #if defined(SIZEOF___INT64)
2019 #  define LZO_SIZEOF___INT64        (SIZEOF___INT64)
2020 #endif
2021 #endif
2022 #ifndef LZO_SIZEOF_VOID_P
2023 #if defined(SIZEOF_VOID_P)
2024 #  define LZO_SIZEOF_VOID_P         (SIZEOF_VOID_P)
2025 #elif defined(__SIZEOF_POINTER__)
2026 #  define LZO_SIZEOF_VOID_P         (__SIZEOF_POINTER__)
2027 #endif
2028 #endif
2029 #ifndef LZO_SIZEOF_SIZE_T
2030 #if defined(SIZEOF_SIZE_T)
2031 #  define LZO_SIZEOF_SIZE_T         (SIZEOF_SIZE_T)
2032 #elif defined(__SIZEOF_SIZE_T__)
2033 #  define LZO_SIZEOF_SIZE_T         (__SIZEOF_SIZE_T__)
2034 #endif
2035 #endif
2036 #ifndef LZO_SIZEOF_PTRDIFF_T
2037 #if defined(SIZEOF_PTRDIFF_T)
2038 #  define LZO_SIZEOF_PTRDIFF_T      (SIZEOF_PTRDIFF_T)
2039 #elif defined(__SIZEOF_PTRDIFF_T__)
2040 #  define LZO_SIZEOF_PTRDIFF_T      (__SIZEOF_PTRDIFF_T__)
2041 #endif
2042 #endif
2043 #define __LZO_LSR(x,b)    (((x)+0ul) >> (b))
2044 #if !defined(LZO_SIZEOF_SHORT)
2045 #  if (LZO_ARCH_CRAY_PVP)
2046 #    define LZO_SIZEOF_SHORT        8
2047 #  elif (USHRT_MAX == LZO_0xffffL)
2048 #    define LZO_SIZEOF_SHORT        2
2049 #  elif (__LZO_LSR(USHRT_MAX,7) == 1)
2050 #    define LZO_SIZEOF_SHORT        1
2051 #  elif (__LZO_LSR(USHRT_MAX,15) == 1)
2052 #    define LZO_SIZEOF_SHORT        2
2053 #  elif (__LZO_LSR(USHRT_MAX,31) == 1)
2054 #    define LZO_SIZEOF_SHORT        4
2055 #  elif (__LZO_LSR(USHRT_MAX,63) == 1)
2056 #    define LZO_SIZEOF_SHORT        8
2057 #  elif (__LZO_LSR(USHRT_MAX,127) == 1)
2058 #    define LZO_SIZEOF_SHORT        16
2059 #  else
2060 #    error "LZO_SIZEOF_SHORT"
2061 #  endif
2062 #endif
2063 LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_SHORT == sizeof(short))
2064 #if !defined(LZO_SIZEOF_INT)
2065 #  if (LZO_ARCH_CRAY_PVP)
2066 #    define LZO_SIZEOF_INT          8
2067 #  elif (UINT_MAX == LZO_0xffffL)
2068 #    define LZO_SIZEOF_INT          2
2069 #  elif (UINT_MAX == LZO_0xffffffffL)
2070 #    define LZO_SIZEOF_INT          4
2071 #  elif (__LZO_LSR(UINT_MAX,7) == 1)
2072 #    define LZO_SIZEOF_INT          1
2073 #  elif (__LZO_LSR(UINT_MAX,15) == 1)
2074 #    define LZO_SIZEOF_INT          2
2075 #  elif (__LZO_LSR(UINT_MAX,31) == 1)
2076 #    define LZO_SIZEOF_INT          4
2077 #  elif (__LZO_LSR(UINT_MAX,63) == 1)
2078 #    define LZO_SIZEOF_INT          8
2079 #  elif (__LZO_LSR(UINT_MAX,127) == 1)
2080 #    define LZO_SIZEOF_INT          16
2081 #  else
2082 #    error "LZO_SIZEOF_INT"
2083 #  endif
2084 #endif
2085 LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_INT == sizeof(int))
2086 #if !defined(LZO_SIZEOF_LONG)
2087 #  if (ULONG_MAX == LZO_0xffffffffL)
2088 #    define LZO_SIZEOF_LONG         4
2089 #  elif (__LZO_LSR(ULONG_MAX,7) == 1)
2090 #    define LZO_SIZEOF_LONG         1
2091 #  elif (__LZO_LSR(ULONG_MAX,15) == 1)
2092 #    define LZO_SIZEOF_LONG         2
2093 #  elif (__LZO_LSR(ULONG_MAX,31) == 1)
2094 #    define LZO_SIZEOF_LONG         4
2095 #  elif (__LZO_LSR(ULONG_MAX,39) == 1)
2096 #    define LZO_SIZEOF_LONG         5
2097 #  elif (__LZO_LSR(ULONG_MAX,63) == 1)
2098 #    define LZO_SIZEOF_LONG         8
2099 #  elif (__LZO_LSR(ULONG_MAX,127) == 1)
2100 #    define LZO_SIZEOF_LONG         16
2101 #  else
2102 #    error "LZO_SIZEOF_LONG"
2103 #  endif
2104 #endif
2105 LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_LONG == sizeof(long))
2106 #if !defined(LZO_SIZEOF_LONG_LONG) && !defined(LZO_SIZEOF___INT64)
2107 #if (LZO_SIZEOF_LONG > 0 && LZO_SIZEOF_LONG < 8)
2108 #  if defined(__LONG_MAX__) && defined(__LONG_LONG_MAX__)
2109 #    if (LZO_CC_GNUC >= 0x030300ul)
2110 #      if ((__LONG_MAX__-0) == (__LONG_LONG_MAX__-0))
2111 #        define LZO_SIZEOF_LONG_LONG      LZO_SIZEOF_LONG
2112 #      elif (__LZO_LSR(__LONG_LONG_MAX__,30) == 1)
2113 #        define LZO_SIZEOF_LONG_LONG      4
2114 #      endif
2115 #    endif
2116 #  endif
2117 #endif
2118 #endif
2119 #if !defined(LZO_SIZEOF_LONG_LONG) && !defined(LZO_SIZEOF___INT64)
2120 #if (LZO_SIZEOF_LONG > 0 && LZO_SIZEOF_LONG < 8)
2121 #if (LZO_ARCH_I086 && LZO_CC_DMC)
2122 #elif (LZO_CC_CILLY) && defined(__GNUC__)
2123 #  define LZO_SIZEOF_LONG_LONG      8
2124 #elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE)
2125 #  define LZO_SIZEOF_LONG_LONG      8
2126 #elif ((LZO_OS_WIN32 || LZO_OS_WIN64 || defined(_WIN32)) && LZO_CC_MSC && (_MSC_VER >= 1400))
2127 #  define LZO_SIZEOF_LONG_LONG      8
2128 #elif (LZO_OS_WIN64 || defined(_WIN64))
2129 #  define LZO_SIZEOF___INT64        8
2130 #elif (LZO_ARCH_I386 && (LZO_CC_DMC))
2131 #  define LZO_SIZEOF_LONG_LONG      8
2132 #elif (LZO_ARCH_I386 && (LZO_CC_SYMANTECC && (__SC__ >= 0x700)))
2133 #  define LZO_SIZEOF_LONG_LONG      8
2134 #elif (LZO_ARCH_I386 && (LZO_CC_INTELC && defined(__linux__)))
2135 #  define LZO_SIZEOF_LONG_LONG      8
2136 #elif (LZO_ARCH_I386 && (LZO_CC_MWERKS || LZO_CC_PELLESC || LZO_CC_PGI || LZO_CC_SUNPROC))
2137 #  define LZO_SIZEOF_LONG_LONG      8
2138 #elif (LZO_ARCH_I386 && (LZO_CC_INTELC || LZO_CC_MSC))
2139 #  define LZO_SIZEOF___INT64        8
2140 #elif ((LZO_OS_WIN32 || defined(_WIN32)) && (LZO_CC_MSC))
2141 #  define LZO_SIZEOF___INT64        8
2142 #elif (LZO_ARCH_I386 && (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0520)))
2143 #  define LZO_SIZEOF___INT64        8
2144 #elif (LZO_ARCH_I386 && (LZO_CC_WATCOMC && (__WATCOMC__ >= 1100)))
2145 #  define LZO_SIZEOF___INT64        8
2146 #elif (LZO_CC_GHS && defined(__LLONG_BIT) && ((__LLONG_BIT-0) == 64))
2147 #  define LZO_SIZEOF_LONG_LONG      8
2148 #elif (LZO_CC_WATCOMC && defined(_INTEGRAL_MAX_BITS) && ((_INTEGRAL_MAX_BITS-0) == 64))
2149 #  define LZO_SIZEOF___INT64        8
2150 #elif (LZO_OS_OS400 || defined(__OS400__)) && defined(__LLP64_IFC__)
2151 #  define LZO_SIZEOF_LONG_LONG      8
2152 #elif (defined(__vms) || defined(__VMS)) && ((__INITIAL_POINTER_SIZE-0) == 64)
2153 #  define LZO_SIZEOF_LONG_LONG      8
2154 #elif (LZO_CC_SDCC) && (LZO_SIZEOF_INT == 2)
2155 #elif 1 && defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
2156 #  define LZO_SIZEOF_LONG_LONG      8
2157 #endif
2158 #endif
2159 #endif
2160 #if defined(__cplusplus) && (LZO_CC_GNUC)
2161 #  if (LZO_CC_GNUC < 0x020800ul)
2162 #    undef LZO_SIZEOF_LONG_LONG
2163 #  endif
2164 #endif
2165 #if (LZO_CFG_NO_LONG_LONG)
2166 #  undef LZO_SIZEOF_LONG_LONG
2167 #elif defined(__NO_LONG_LONG)
2168 #  undef LZO_SIZEOF_LONG_LONG
2169 #elif defined(_NO_LONGLONG)
2170 #  undef LZO_SIZEOF_LONG_LONG
2171 #endif
2172 #if !defined(LZO_WORDSIZE)
2173 #if (LZO_ARCH_ALPHA)
2174 #  define LZO_WORDSIZE              8
2175 #elif (LZO_ARCH_AMD64)
2176 #  define LZO_WORDSIZE              8
2177 #elif (LZO_ARCH_AVR)
2178 #  define LZO_WORDSIZE              1
2179 #elif (LZO_ARCH_H8300)
2180 #  if defined(__NORMAL_MODE__)
2181 #    define LZO_WORDSIZE            4
2182 #  elif defined(__H8300H__) || defined(__H8300S__) || defined(__H8300SX__)
2183 #    define LZO_WORDSIZE            4
2184 #  else
2185 #    define LZO_WORDSIZE            2
2186 #  endif
2187 #elif (LZO_ARCH_I086)
2188 #  define LZO_WORDSIZE              2
2189 #elif (LZO_ARCH_IA64)
2190 #  define LZO_WORDSIZE              8
2191 #elif (LZO_ARCH_M16C)
2192 #  define LZO_WORDSIZE              2
2193 #elif (LZO_ARCH_SPU)
2194 #  define LZO_WORDSIZE              4
2195 #elif (LZO_ARCH_Z80)
2196 #  define LZO_WORDSIZE              1
2197 #elif (LZO_SIZEOF_LONG == 8) && ((defined(__mips__) && defined(__R5900__)) || defined(__MIPS_PSX2__))
2198 #  define LZO_WORDSIZE              8
2199 #elif (LZO_OS_OS400 || defined(__OS400__))
2200 #  define LZO_WORDSIZE              8
2201 #elif (defined(__vms) || defined(__VMS)) && (__INITIAL_POINTER_SIZE+0 == 64)
2202 #  define LZO_WORDSIZE              8
2203 #endif
2204 #endif
2205 #if !defined(LZO_SIZEOF_VOID_P)
2206 #if defined(__ILP32__) || defined(__ILP32) || defined(_ILP32)
2207 LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(int)  == 4)
2208 LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(long) == 4)
2209 #  define LZO_SIZEOF_VOID_P         4
2210 #elif defined(__ILP64__) || defined(__ILP64) || defined(_ILP64)
2211 LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(int)  == 8)
2212 LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(long) == 8)
2213 #  define LZO_SIZEOF_VOID_P         8
2214 #elif defined(__LLP64__) || defined(__LLP64) || defined(_LLP64) || defined(_WIN64)
2215 LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(long) == 4)
2216 #  define LZO_SIZEOF_VOID_P         8
2217 #elif defined(__LP64__) || defined(__LP64) || defined(_LP64)
2218 LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(long) == 8)
2219 #  define LZO_SIZEOF_VOID_P         8
2220 #elif (LZO_ARCH_AVR)
2221 #  define LZO_SIZEOF_VOID_P         2
2222 #elif (LZO_ARCH_C166 || LZO_ARCH_MCS51 || LZO_ARCH_MCS251 || LZO_ARCH_MSP430)
2223 #  define LZO_SIZEOF_VOID_P         2
2224 #elif (LZO_ARCH_H8300)
2225 #  if defined(__NORMAL_MODE__)
2226 #    define LZO_SIZEOF_VOID_P       2
2227 #  elif defined(__H8300H__) || defined(__H8300S__) || defined(__H8300SX__)
2228 #    define LZO_SIZEOF_VOID_P       4
2229 #  else
2230 #    define LZO_SIZEOF_VOID_P       2
2231 #  endif
2232 #  if (LZO_CC_GNUC && (LZO_CC_GNUC < 0x040000ul)) && (LZO_SIZEOF_INT == 4)
2233 #    define LZO_SIZEOF_SIZE_T       LZO_SIZEOF_INT
2234 #    define LZO_SIZEOF_PTRDIFF_T    LZO_SIZEOF_INT
2235 #  endif
2236 #elif (LZO_ARCH_I086)
2237 #  if (LZO_MM_TINY || LZO_MM_SMALL || LZO_MM_MEDIUM)
2238 #    define LZO_SIZEOF_VOID_P       2
2239 #  elif (LZO_MM_COMPACT || LZO_MM_LARGE || LZO_MM_HUGE)
2240 #    define LZO_SIZEOF_VOID_P       4
2241 #  else
2242 #    error "invalid LZO_ARCH_I086 memory model"
2243 #  endif
2244 #elif (LZO_ARCH_M16C)
2245 #  if defined(__m32c_cpu__) || defined(__m32cm_cpu__)
2246 #    define LZO_SIZEOF_VOID_P       4
2247 #  else
2248 #    define LZO_SIZEOF_VOID_P       2
2249 #  endif
2250 #elif (LZO_ARCH_SPU)
2251 #  define LZO_SIZEOF_VOID_P         4
2252 #elif (LZO_ARCH_Z80)
2253 #  define LZO_SIZEOF_VOID_P         2
2254 #elif (LZO_SIZEOF_LONG == 8) && ((defined(__mips__) && defined(__R5900__)) || defined(__MIPS_PSX2__))
2255 #  define LZO_SIZEOF_VOID_P         4
2256 #elif (LZO_OS_OS400 || defined(__OS400__))
2257 #  if defined(__LLP64_IFC__)
2258 #    define LZO_SIZEOF_VOID_P       8
2259 #    define LZO_SIZEOF_SIZE_T       LZO_SIZEOF_LONG
2260 #    define LZO_SIZEOF_PTRDIFF_T    LZO_SIZEOF_LONG
2261 #  else
2262 #    define LZO_SIZEOF_VOID_P       16
2263 #    define LZO_SIZEOF_SIZE_T       LZO_SIZEOF_LONG
2264 #    define LZO_SIZEOF_PTRDIFF_T    LZO_SIZEOF_LONG
2265 #  endif
2266 #elif (defined(__vms) || defined(__VMS)) && (__INITIAL_POINTER_SIZE+0 == 64)
2267 #  define LZO_SIZEOF_VOID_P         8
2268 #  define LZO_SIZEOF_SIZE_T         LZO_SIZEOF_LONG
2269 #  define LZO_SIZEOF_PTRDIFF_T      LZO_SIZEOF_LONG
2270 #endif
2271 #endif
2272 #if !defined(LZO_SIZEOF_VOID_P)
2273 #  define LZO_SIZEOF_VOID_P         LZO_SIZEOF_LONG
2274 #endif
2275 LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_VOID_P == sizeof(void *))
2276 #if !defined(LZO_SIZEOF_SIZE_T)
2277 #if (LZO_ARCH_I086 || LZO_ARCH_M16C)
2278 #  define LZO_SIZEOF_SIZE_T         2
2279 #endif
2280 #endif
2281 #if !defined(LZO_SIZEOF_SIZE_T)
2282 #  define LZO_SIZEOF_SIZE_T         LZO_SIZEOF_VOID_P
2283 #endif
2284 #if defined(offsetof)
2285 LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_SIZE_T == sizeof(size_t))
2286 #endif
2287 #if !defined(LZO_SIZEOF_PTRDIFF_T)
2288 #if (LZO_ARCH_I086)
2289 #  if (LZO_MM_TINY || LZO_MM_SMALL || LZO_MM_MEDIUM || LZO_MM_HUGE)
2290 #    define LZO_SIZEOF_PTRDIFF_T    LZO_SIZEOF_VOID_P
2291 #  elif (LZO_MM_COMPACT || LZO_MM_LARGE)
2292 #    if (LZO_CC_BORLANDC || LZO_CC_TURBOC)
2293 #      define LZO_SIZEOF_PTRDIFF_T  4
2294 #    else
2295 #      define LZO_SIZEOF_PTRDIFF_T  2
2296 #    endif
2297 #  else
2298 #    error "invalid LZO_ARCH_I086 memory model"
2299 #  endif
2300 #endif
2301 #endif
2302 #if !defined(LZO_SIZEOF_PTRDIFF_T)
2303 #  define LZO_SIZEOF_PTRDIFF_T      LZO_SIZEOF_SIZE_T
2304 #endif
2305 #if defined(offsetof)
2306 LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_PTRDIFF_T == sizeof(ptrdiff_t))
2307 #endif
2308 #if !defined(LZO_WORDSIZE)
2309 #  define LZO_WORDSIZE              LZO_SIZEOF_VOID_P
2310 #endif
2311 #if (LZO_ABI_NEUTRAL_ENDIAN)
2312 #  undef LZO_ABI_BIG_ENDIAN
2313 #  undef LZO_ABI_LITTLE_ENDIAN
2314 #elif !(LZO_ABI_BIG_ENDIAN) && !(LZO_ABI_LITTLE_ENDIAN)
2315 #if (LZO_ARCH_ALPHA) && (LZO_ARCH_CRAY_MPP)
2316 #  define LZO_ABI_BIG_ENDIAN        1
2317 #elif (LZO_ARCH_IA64) && (LZO_OS_POSIX_LINUX || LZO_OS_WIN64)
2318 #  define LZO_ABI_LITTLE_ENDIAN     1
2319 #elif (LZO_ARCH_ALPHA || LZO_ARCH_AMD64 || LZO_ARCH_BLACKFIN || LZO_ARCH_CRIS || LZO_ARCH_I086 || LZO_ARCH_I386 || LZO_ARCH_MSP430)
2320 #  define LZO_ABI_LITTLE_ENDIAN     1
2321 #elif (LZO_ARCH_AVR32 || LZO_ARCH_M68K || LZO_ARCH_S390 || LZO_ARCH_SPU)
2322 #  define LZO_ABI_BIG_ENDIAN        1
2323 #elif 1 && defined(__IAR_SYSTEMS_ICC__) && defined(__LITTLE_ENDIAN__)
2324 #  if (__LITTLE_ENDIAN__ == 1)
2325 #    define LZO_ABI_LITTLE_ENDIAN   1
2326 #  else
2327 #    define LZO_ABI_BIG_ENDIAN      1
2328 #  endif
2329 #elif 1 && defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__)
2330 #  define LZO_ABI_BIG_ENDIAN        1
2331 #elif 1 && defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__)
2332 #  define LZO_ABI_LITTLE_ENDIAN     1
2333 #elif 1 && (LZO_ARCH_ARM) && defined(__ARMEB__) && !defined(__ARMEL__)
2334 #  define LZO_ABI_BIG_ENDIAN        1
2335 #elif 1 && (LZO_ARCH_ARM) && defined(__ARMEL__) && !defined(__ARMEB__)
2336 #  define LZO_ABI_LITTLE_ENDIAN     1
2337 #elif 1 && (LZO_ARCH_ARM && LZO_CC_ARMCC_ARMCC)
2338 #  if defined(__BIG_ENDIAN) && defined(__LITTLE_ENDIAN)
2339 #    error "unexpected configuration - check your compiler defines"
2340 #  elif defined(__BIG_ENDIAN)
2341 #    define LZO_ABI_BIG_ENDIAN      1
2342 #  else
2343 #    define LZO_ABI_LITTLE_ENDIAN   1
2344 #  endif
2345 #  define LZO_ABI_LITTLE_ENDIAN     1
2346 #elif 1 && (LZO_ARCH_ARM64) && defined(__AARCH64EB__) && !defined(__AARCH64EL__)
2347 #  define LZO_ABI_BIG_ENDIAN        1
2348 #elif 1 && (LZO_ARCH_ARM64) && defined(__AARCH64EL__) && !defined(__AARCH64EB__)
2349 #  define LZO_ABI_LITTLE_ENDIAN     1
2350 #elif 1 && (LZO_ARCH_MIPS) && defined(__MIPSEB__) && !defined(__MIPSEL__)
2351 #  define LZO_ABI_BIG_ENDIAN        1
2352 #elif 1 && (LZO_ARCH_MIPS) && defined(__MIPSEL__) && !defined(__MIPSEB__)
2353 #  define LZO_ABI_LITTLE_ENDIAN     1
2354 #endif
2355 #endif
2356 #if (LZO_ABI_BIG_ENDIAN) && (LZO_ABI_LITTLE_ENDIAN)
2357 #  error "unexpected configuration - check your compiler defines"
2358 #endif
2359 #if (LZO_ABI_BIG_ENDIAN)
2360 #  define LZO_INFO_ABI_ENDIAN       "be"
2361 #elif (LZO_ABI_LITTLE_ENDIAN)
2362 #  define LZO_INFO_ABI_ENDIAN       "le"
2363 #elif (LZO_ABI_NEUTRAL_ENDIAN)
2364 #  define LZO_INFO_ABI_ENDIAN       "neutral"
2365 #endif
2366 #if (LZO_SIZEOF_INT == 1 && LZO_SIZEOF_LONG == 2 && LZO_SIZEOF_VOID_P == 2)
2367 #  define LZO_ABI_I8LP16         1
2368 #  define LZO_INFO_ABI_PM       "i8lp16"
2369 #elif (LZO_SIZEOF_INT == 2 && LZO_SIZEOF_LONG == 2 && LZO_SIZEOF_VOID_P == 2)
2370 #  define LZO_ABI_ILP16         1
2371 #  define LZO_INFO_ABI_PM       "ilp16"
2372 #elif (LZO_SIZEOF_INT == 2 && LZO_SIZEOF_LONG == 4 && LZO_SIZEOF_VOID_P == 4)
2373 #  define LZO_ABI_LP32          1
2374 #  define LZO_INFO_ABI_PM       "lp32"
2375 #elif (LZO_SIZEOF_INT == 4 && LZO_SIZEOF_LONG == 4 && LZO_SIZEOF_VOID_P == 4)
2376 #  define LZO_ABI_ILP32         1
2377 #  define LZO_INFO_ABI_PM       "ilp32"
2378 #elif (LZO_SIZEOF_INT == 4 && LZO_SIZEOF_LONG == 4 && LZO_SIZEOF_VOID_P == 8 && LZO_SIZEOF_SIZE_T == 8)
2379 #  define LZO_ABI_LLP64         1
2380 #  define LZO_INFO_ABI_PM       "llp64"
2381 #elif (LZO_SIZEOF_INT == 4 && LZO_SIZEOF_LONG == 8 && LZO_SIZEOF_VOID_P == 8)
2382 #  define LZO_ABI_LP64          1
2383 #  define LZO_INFO_ABI_PM       "lp64"
2384 #elif (LZO_SIZEOF_INT == 8 && LZO_SIZEOF_LONG == 8 && LZO_SIZEOF_VOID_P == 8)
2385 #  define LZO_ABI_ILP64         1
2386 #  define LZO_INFO_ABI_PM       "ilp64"
2387 #elif (LZO_SIZEOF_INT == 4 && LZO_SIZEOF_LONG == 8 && LZO_SIZEOF_VOID_P == 4)
2388 #  define LZO_ABI_IP32L64       1
2389 #  define LZO_INFO_ABI_PM       "ip32l64"
2390 #endif
2391 #if 0
2392 #elif !defined(__LZO_LIBC_OVERRIDE)
2393 #if (LZO_LIBC_NAKED)
2394 #  define LZO_INFO_LIBC         "naked"
2395 #elif (LZO_LIBC_FREESTANDING)
2396 #  define LZO_INFO_LIBC         "freestanding"
2397 #elif (LZO_LIBC_MOSTLY_FREESTANDING)
2398 #  define LZO_INFO_LIBC         "mfreestanding"
2399 #elif (LZO_LIBC_ISOC90)
2400 #  define LZO_INFO_LIBC         "isoc90"
2401 #elif (LZO_LIBC_ISOC99)
2402 #  define LZO_INFO_LIBC         "isoc99"
2403 #elif (LZO_CC_ARMCC_ARMCC) && defined(__ARMCLIB_VERSION)
2404 #  define LZO_LIBC_ISOC90       1
2405 #  define LZO_INFO_LIBC         "isoc90"
2406 #elif defined(__dietlibc__)
2407 #  define LZO_LIBC_DIETLIBC     1
2408 #  define LZO_INFO_LIBC         "dietlibc"
2409 #elif defined(_NEWLIB_VERSION)
2410 #  define LZO_LIBC_NEWLIB       1
2411 #  define LZO_INFO_LIBC         "newlib"
2412 #elif defined(__UCLIBC__) && defined(__UCLIBC_MAJOR__) && defined(__UCLIBC_MINOR__)
2413 #  if defined(__UCLIBC_SUBLEVEL__)
2414 #    define LZO_LIBC_UCLIBC     (__UCLIBC_MAJOR__ * 0x10000L + (__UCLIBC_MINOR__-0) * 0x100 + (__UCLIBC_SUBLEVEL__-0))
2415 #  else
2416 #    define LZO_LIBC_UCLIBC     0x00090bL
2417 #  endif
2418 #  define LZO_INFO_LIBC         "uc" "libc"
2419 #elif defined(__GLIBC__) && defined(__GLIBC_MINOR__)
2420 #  define LZO_LIBC_GLIBC        (__GLIBC__ * 0x10000L + (__GLIBC_MINOR__-0) * 0x100)
2421 #  define LZO_INFO_LIBC         "glibc"
2422 #elif (LZO_CC_MWERKS) && defined(__MSL__)
2423 #  define LZO_LIBC_MSL          __MSL__
2424 #  define LZO_INFO_LIBC         "msl"
2425 #elif 1 && defined(__IAR_SYSTEMS_ICC__)
2426 #  define LZO_LIBC_ISOC90       1
2427 #  define LZO_INFO_LIBC         "isoc90"
2428 #else
2429 #  define LZO_LIBC_DEFAULT      1
2430 #  define LZO_INFO_LIBC         "default"
2431 #endif
2432 #endif
2433 #if (LZO_ARCH_I386 && (LZO_OS_DOS32 || LZO_OS_WIN32) && (LZO_CC_DMC || LZO_CC_INTELC || LZO_CC_MSC || LZO_CC_PELLESC))
2434 #  define LZO_ASM_SYNTAX_MSC 1
2435 #elif (LZO_OS_WIN64 && (LZO_CC_DMC || LZO_CC_INTELC || LZO_CC_MSC || LZO_CC_PELLESC))
2436 #elif (LZO_ARCH_I386 && LZO_CC_GNUC && (LZO_CC_GNUC == 0x011f00ul))
2437 #elif (LZO_ARCH_I386 && (LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_INTELC || LZO_CC_PATHSCALE))
2438 #  define LZO_ASM_SYNTAX_GNUC 1
2439 #elif (LZO_ARCH_AMD64 && (LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_INTELC || LZO_CC_PATHSCALE))
2440 #  define LZO_ASM_SYNTAX_GNUC 1
2441 #elif (LZO_CC_GNUC)
2442 #  define LZO_ASM_SYNTAX_GNUC 1
2443 #endif
2444 #if (LZO_ASM_SYNTAX_GNUC)
2445 #if (LZO_ARCH_I386 && LZO_CC_GNUC && (LZO_CC_GNUC < 0x020000ul))
2446 #  define __LZO_ASM_CLOBBER                     "ax"
2447 #  define __LZO_ASM_CLOBBER_LIST_CC             /*empty*/
2448 #  define __LZO_ASM_CLOBBER_LIST_CC_MEMORY      /*empty*/
2449 #  define __LZO_ASM_CLOBBER_LIST_EMPTY          /*empty*/
2450 #elif (LZO_CC_INTELC && (__INTEL_COMPILER < 1000))
2451 #  define __LZO_ASM_CLOBBER                     "memory"
2452 #  define __LZO_ASM_CLOBBER_LIST_CC             /*empty*/
2453 #  define __LZO_ASM_CLOBBER_LIST_CC_MEMORY      : "memory"
2454 #  define __LZO_ASM_CLOBBER_LIST_EMPTY          /*empty*/
2455 #else
2456 #  define __LZO_ASM_CLOBBER                     "cc", "memory"
2457 #  define __LZO_ASM_CLOBBER_LIST_CC             : "cc"
2458 #  define __LZO_ASM_CLOBBER_LIST_CC_MEMORY      : "cc", "memory"
2459 #  define __LZO_ASM_CLOBBER_LIST_EMPTY          /*empty*/
2460 #endif
2461 #endif
2462 #if (LZO_ARCH_ALPHA)
2463 #  define LZO_OPT_AVOID_UINT_INDEX          1
2464 #elif (LZO_ARCH_AMD64)
2465 #  define LZO_OPT_AVOID_INT_INDEX           1
2466 #  define LZO_OPT_AVOID_UINT_INDEX          1
2467 #  ifndef LZO_OPT_UNALIGNED16
2468 #  define LZO_OPT_UNALIGNED16               1
2469 #  endif
2470 #  ifndef LZO_OPT_UNALIGNED32
2471 #  define LZO_OPT_UNALIGNED32               1
2472 #  endif
2473 #  ifndef LZO_OPT_UNALIGNED64
2474 #  define LZO_OPT_UNALIGNED64               1
2475 #  endif
2476 #elif (LZO_ARCH_ARM)
2477 #  if defined(__ARM_FEATURE_UNALIGNED)
2478 #    ifndef LZO_OPT_UNALIGNED16
2479 #    define LZO_OPT_UNALIGNED16             1
2480 #    endif
2481 #    ifndef LZO_OPT_UNALIGNED32
2482 #    define LZO_OPT_UNALIGNED32             1
2483 #    endif
2484 #  elif defined(__TARGET_ARCH_ARM) && ((__TARGET_ARCH_ARM+0) >= 7)
2485 #    ifndef LZO_OPT_UNALIGNED16
2486 #    define LZO_OPT_UNALIGNED16             1
2487 #    endif
2488 #    ifndef LZO_OPT_UNALIGNED32
2489 #    define LZO_OPT_UNALIGNED32             1
2490 #    endif
2491 #  elif defined(__TARGET_ARCH_ARM) && ((__TARGET_ARCH_ARM+0) >= 6) && !defined(__TARGET_PROFILE_M)
2492 #    ifndef LZO_OPT_UNALIGNED16
2493 #    define LZO_OPT_UNALIGNED16             1
2494 #    endif
2495 #    ifndef LZO_OPT_UNALIGNED32
2496 #    define LZO_OPT_UNALIGNED32             1
2497 #    endif
2498 #  endif
2499 #elif (LZO_ARCH_ARM64)
2500 #  ifndef LZO_OPT_UNALIGNED16
2501 #  define LZO_OPT_UNALIGNED16               1
2502 #  endif
2503 #  ifndef LZO_OPT_UNALIGNED32
2504 #  define LZO_OPT_UNALIGNED32               1
2505 #  endif
2506 #  ifndef LZO_OPT_UNALIGNED64
2507 #  define LZO_OPT_UNALIGNED64               1
2508 #  endif
2509 #elif (LZO_ARCH_CRIS)
2510 #  ifndef LZO_OPT_UNALIGNED16
2511 #  define LZO_OPT_UNALIGNED16               1
2512 #  endif
2513 #  ifndef LZO_OPT_UNALIGNED32
2514 #  define LZO_OPT_UNALIGNED32               1
2515 #  endif
2516 #elif (LZO_ARCH_I386)
2517 #  ifndef LZO_OPT_UNALIGNED16
2518 #  define LZO_OPT_UNALIGNED16               1
2519 #  endif
2520 #  ifndef LZO_OPT_UNALIGNED32
2521 #  define LZO_OPT_UNALIGNED32               1
2522 #  endif
2523 #elif (LZO_ARCH_IA64)
2524 #  define LZO_OPT_AVOID_INT_INDEX           1
2525 #  define LZO_OPT_AVOID_UINT_INDEX          1
2526 #  define LZO_OPT_PREFER_POSTINC            1
2527 #elif (LZO_ARCH_M68K)
2528 #  define LZO_OPT_PREFER_POSTINC            1
2529 #  define LZO_OPT_PREFER_PREDEC             1
2530 #  if defined(__mc68020__) && !defined(__mcoldfire__)
2531 #    ifndef LZO_OPT_UNALIGNED16
2532 #    define LZO_OPT_UNALIGNED16             1
2533 #    endif
2534 #    ifndef LZO_OPT_UNALIGNED32
2535 #    define LZO_OPT_UNALIGNED32             1
2536 #    endif
2537 #  endif
2538 #elif (LZO_ARCH_MIPS)
2539 #  define LZO_OPT_AVOID_UINT_INDEX          1
2540 #elif (LZO_ARCH_POWERPC)
2541 #  define LZO_OPT_PREFER_PREINC             1
2542 #  define LZO_OPT_PREFER_PREDEC             1
2543 #  if (LZO_ABI_BIG_ENDIAN)
2544 #    ifndef LZO_OPT_UNALIGNED16
2545 #    define LZO_OPT_UNALIGNED16             1
2546 #    endif
2547 #    ifndef LZO_OPT_UNALIGNED32
2548 #    define LZO_OPT_UNALIGNED32             1
2549 #    endif
2550 #    if (LZO_WORDSIZE == 8)
2551 #      ifndef LZO_OPT_UNALIGNED64
2552 #      define LZO_OPT_UNALIGNED64           1
2553 #      endif
2554 #    endif
2555 #  endif
2556 #elif (LZO_ARCH_S390)
2557 #  ifndef LZO_OPT_UNALIGNED16
2558 #  define LZO_OPT_UNALIGNED16               1
2559 #  endif
2560 #  ifndef LZO_OPT_UNALIGNED32
2561 #  define LZO_OPT_UNALIGNED32               1
2562 #  endif
2563 #  if (LZO_WORDSIZE == 8)
2564 #    ifndef LZO_OPT_UNALIGNED64
2565 #    define LZO_OPT_UNALIGNED64             1
2566 #    endif
2567 #  endif
2568 #elif (LZO_ARCH_SH)
2569 #  define LZO_OPT_PREFER_POSTINC            1
2570 #  define LZO_OPT_PREFER_PREDEC             1
2571 #endif
2572 #ifndef LZO_CFG_NO_INLINE_ASM
2573 #if (LZO_ABI_NEUTRAL_ENDIAN) || (LZO_ARCH_GENERIC)
2574 #  define LZO_CFG_NO_INLINE_ASM 1
2575 #elif (LZO_CC_LLVM)
2576 #  define LZO_CFG_NO_INLINE_ASM 1
2577 #endif
2578 #endif
2579 #if (LZO_CFG_NO_INLINE_ASM)
2580 #  undef LZO_ASM_SYNTAX_MSC
2581 #  undef LZO_ASM_SYNTAX_GNUC
2582 #  undef __LZO_ASM_CLOBBER
2583 #  undef __LZO_ASM_CLOBBER_LIST_CC
2584 #  undef __LZO_ASM_CLOBBER_LIST_CC_MEMORY
2585 #  undef __LZO_ASM_CLOBBER_LIST_EMPTY
2586 #endif
2587 #ifndef LZO_CFG_NO_UNALIGNED
2588 #if (LZO_ABI_NEUTRAL_ENDIAN) || (LZO_ARCH_GENERIC)
2589 #  define LZO_CFG_NO_UNALIGNED 1
2590 #endif
2591 #endif
2592 #if (LZO_CFG_NO_UNALIGNED)
2593 #  undef LZO_OPT_UNALIGNED16
2594 #  undef LZO_OPT_UNALIGNED32
2595 #  undef LZO_OPT_UNALIGNED64
2596 #endif
2597 #if defined(__LZO_INFOSTR_MM)
2598 #elif (LZO_MM_FLAT) && (defined(__LZO_INFOSTR_PM) || defined(LZO_INFO_ABI_PM))
2599 #  define __LZO_INFOSTR_MM          ""
2600 #elif defined(LZO_INFO_MM)
2601 #  define __LZO_INFOSTR_MM          "." LZO_INFO_MM
2602 #else
2603 #  define __LZO_INFOSTR_MM          ""
2604 #endif
2605 #if defined(__LZO_INFOSTR_PM)
2606 #elif defined(LZO_INFO_ABI_PM)
2607 #  define __LZO_INFOSTR_PM          "." LZO_INFO_ABI_PM
2608 #else
2609 #  define __LZO_INFOSTR_PM          ""
2610 #endif
2611 #if defined(__LZO_INFOSTR_ENDIAN)
2612 #elif defined(LZO_INFO_ABI_ENDIAN)
2613 #  define __LZO_INFOSTR_ENDIAN      "." LZO_INFO_ABI_ENDIAN
2614 #else
2615 #  define __LZO_INFOSTR_ENDIAN      ""
2616 #endif
2617 #if defined(__LZO_INFOSTR_OSNAME)
2618 #elif defined(LZO_INFO_OS_CONSOLE)
2619 #  define __LZO_INFOSTR_OSNAME      LZO_INFO_OS "." LZO_INFO_OS_CONSOLE
2620 #elif defined(LZO_INFO_OS_POSIX)
2621 #  define __LZO_INFOSTR_OSNAME      LZO_INFO_OS "." LZO_INFO_OS_POSIX
2622 #else
2623 #  define __LZO_INFOSTR_OSNAME      LZO_INFO_OS
2624 #endif
2625 #if defined(__LZO_INFOSTR_LIBC)
2626 #elif defined(LZO_INFO_LIBC)
2627 #  define __LZO_INFOSTR_LIBC        "." LZO_INFO_LIBC
2628 #else
2629 #  define __LZO_INFOSTR_LIBC        ""
2630 #endif
2631 #if defined(__LZO_INFOSTR_CCVER)
2632 #elif defined(LZO_INFO_CCVER)
2633 #  define __LZO_INFOSTR_CCVER       " " LZO_INFO_CCVER
2634 #else
2635 #  define __LZO_INFOSTR_CCVER       ""
2636 #endif
2637 #define LZO_INFO_STRING \
2638     LZO_INFO_ARCH __LZO_INFOSTR_MM __LZO_INFOSTR_PM __LZO_INFOSTR_ENDIAN \
2639     " " __LZO_INFOSTR_OSNAME __LZO_INFOSTR_LIBC " " LZO_INFO_CC __LZO_INFOSTR_CCVER
2640 #if !(LZO_CFG_SKIP_LZO_TYPES)
2641 #if (!(LZO_SIZEOF_SHORT+0 > 0 && LZO_SIZEOF_INT+0 > 0 && LZO_SIZEOF_LONG+0 > 0))
2642 #  error "missing defines for sizes"
2643 #endif
2644 #if (!(LZO_SIZEOF_PTRDIFF_T+0 > 0 && LZO_SIZEOF_SIZE_T+0 > 0 && LZO_SIZEOF_VOID_P+0 > 0))
2645 #  error "missing defines for sizes"
2646 #endif
2647 #if !defined(lzo_llong_t)
2648 #if (LZO_SIZEOF_LONG_LONG+0 > 0)
2649 __lzo_gnuc_extension__ typedef long long lzo_llong_t__;
2650 __lzo_gnuc_extension__ typedef unsigned long long lzo_ullong_t__;
2651 #  define lzo_llong_t               lzo_llong_t__
2652 #  define lzo_ullong_t              lzo_ullong_t__
2653 #endif
2654 #endif
2655 #if !defined(lzo_int16e_t)
2656 #if (LZO_SIZEOF_LONG == 2)
2657 #  define lzo_int16e_t              long
2658 #  define lzo_uint16e_t             unsigned long
2659 #elif (LZO_SIZEOF_INT == 2)
2660 #  define lzo_int16e_t              int
2661 #  define lzo_uint16e_t             unsigned int
2662 #elif (LZO_SIZEOF_SHORT == 2)
2663 #  define lzo_int16e_t              short int
2664 #  define lzo_uint16e_t             unsigned short int
2665 #elif 1 && !(LZO_CFG_TYPE_NO_MODE_HI) && (LZO_CC_CLANG || (LZO_CC_GNUC >= 0x025f00ul) || LZO_CC_LLVM)
2666    typedef int lzo_int16e_hi_t__ __attribute__((__mode__(__HI__)));
2667    typedef unsigned int lzo_uint16e_hi_t__ __attribute__((__mode__(__HI__)));
2668 #  define lzo_int16e_t              lzo_int16e_hi_t__
2669 #  define lzo_uint16e_t             lzo_uint16e_hi_t__
2670 #elif (LZO_SIZEOF___INT16 == 2)
2671 #  define lzo_int16e_t              __int16
2672 #  define lzo_uint16e_t             unsigned __int16
2673 #else
2674 #endif
2675 #endif
2676 #if defined(lzo_int16e_t)
2677 #  define LZO_SIZEOF_LZO_INT16E_T   2
2678    LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int16e_t) == 2)
2679    LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int16e_t) == LZO_SIZEOF_LZO_INT16E_T)
2680 #endif
2681 #if !defined(lzo_int32e_t)
2682 #if (LZO_SIZEOF_LONG == 4)
2683 #  define lzo_int32e_t              long int
2684 #  define lzo_uint32e_t             unsigned long int
2685 #elif (LZO_SIZEOF_INT == 4)
2686 #  define lzo_int32e_t              int
2687 #  define lzo_uint32e_t             unsigned int
2688 #elif (LZO_SIZEOF_SHORT == 4)
2689 #  define lzo_int32e_t              short int
2690 #  define lzo_uint32e_t             unsigned short int
2691 #elif (LZO_SIZEOF_LONG_LONG == 4)
2692 #  define lzo_int32e_t              lzo_llong_t
2693 #  define lzo_uint32e_t             lzo_ullong_t
2694 #elif 1 && !(LZO_CFG_TYPE_NO_MODE_SI) && (LZO_CC_CLANG || (LZO_CC_GNUC >= 0x025f00ul) || LZO_CC_LLVM) && (__INT_MAX__+0 > 2147483647L)
2695    typedef int lzo_int32e_si_t__ __attribute__((__mode__(__SI__)));
2696    typedef unsigned int lzo_uint32e_si_t__ __attribute__((__mode__(__SI__)));
2697 #  define lzo_int32e_t              lzo_int32e_si_t__
2698 #  define lzo_uint32e_t             lzo_uint32e_si_t__
2699 #elif 1 && !(LZO_CFG_TYPE_NO_MODE_SI) && (LZO_CC_GNUC >= 0x025f00ul) && defined(__AVR__) && (__LONG_MAX__+0 == 32767L)
2700    typedef int lzo_int32e_si_t__ __attribute__((__mode__(__SI__)));
2701    typedef unsigned int lzo_uint32e_si_t__ __attribute__((__mode__(__SI__)));
2702 #  define lzo_int32e_t              lzo_int32e_si_t__
2703 #  define lzo_uint32e_t             lzo_uint32e_si_t__
2704 #  define LZO_INT32_C(c)            (c##LL)
2705 #  define LZO_UINT32_C(c)           (c##ULL)
2706 #elif (LZO_SIZEOF___INT32 == 4)
2707 #  define lzo_int32e_t              __int32
2708 #  define lzo_uint32e_t             unsigned __int32
2709 #else
2710 #endif
2711 #endif
2712 #if defined(lzo_int32e_t)
2713 #  define LZO_SIZEOF_LZO_INT32E_T   4
2714    LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32e_t) == 4)
2715    LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32e_t) == LZO_SIZEOF_LZO_INT32E_T)
2716 #endif
2717 #if !defined(lzo_int64e_t)
2718 #if (LZO_SIZEOF___INT64 == 8)
2719 #  if (LZO_CC_BORLANDC) && !(LZO_CFG_TYPE_PREFER___INT64)
2720 #    define LZO_CFG_TYPE_PREFER___INT64 1
2721 #  endif
2722 #endif
2723 #if (LZO_SIZEOF_INT == 8) && (LZO_SIZEOF_INT < LZO_SIZEOF_LONG)
2724 #  define lzo_int64e_t              int
2725 #  define lzo_uint64e_t             unsigned int
2726 #  define LZO_SIZEOF_LZO_INT64E_T   LZO_SIZEOF_INT
2727 #elif (LZO_SIZEOF_LONG == 8)
2728 #  define lzo_int64e_t              long int
2729 #  define lzo_uint64e_t             unsigned long int
2730 #  define LZO_SIZEOF_LZO_INT64E_T   LZO_SIZEOF_LONG
2731 #elif (LZO_SIZEOF_LONG_LONG == 8) && !(LZO_CFG_TYPE_PREFER___INT64)
2732 #  define lzo_int64e_t              lzo_llong_t
2733 #  define lzo_uint64e_t             lzo_ullong_t
2734 #  if (LZO_CC_BORLANDC)
2735 #    define LZO_INT64_C(c)          ((c) + 0ll)
2736 #    define LZO_UINT64_C(c)         ((c) + 0ull)
2737 #  elif 0
2738 #    define LZO_INT64_C(c)          (__lzo_gnuc_extension__ (c##LL))
2739 #    define LZO_UINT64_C(c)         (__lzo_gnuc_extension__ (c##ULL))
2740 #  else
2741 #    define LZO_INT64_C(c)          (c##LL)
2742 #    define LZO_UINT64_C(c)         (c##ULL)
2743 #  endif
2744 #  define LZO_SIZEOF_LZO_INT64E_T   LZO_SIZEOF_LONG_LONG
2745 #elif (LZO_SIZEOF___INT64 == 8)
2746 #  define lzo_int64e_t              __int64
2747 #  define lzo_uint64e_t             unsigned __int64
2748 #  if (LZO_CC_BORLANDC)
2749 #    define LZO_INT64_C(c)          ((c) + 0i64)
2750 #    define LZO_UINT64_C(c)         ((c) + 0ui64)
2751 #  else
2752 #    define LZO_INT64_C(c)          (c##i64)
2753 #    define LZO_UINT64_C(c)         (c##ui64)
2754 #  endif
2755 #  define LZO_SIZEOF_LZO_INT64E_T   LZO_SIZEOF___INT64
2756 #else
2757 #endif
2758 #endif
2759 #if defined(lzo_int64e_t)
2760    LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64e_t) == 8)
2761    LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64e_t) == LZO_SIZEOF_LZO_INT64E_T)
2762 #endif
2763 #if !defined(lzo_int32l_t)
2764 #if defined(lzo_int32e_t)
2765 #  define lzo_int32l_t              lzo_int32e_t
2766 #  define lzo_uint32l_t             lzo_uint32e_t
2767 #  define LZO_SIZEOF_LZO_INT32L_T   LZO_SIZEOF_LZO_INT32E_T
2768 #elif (LZO_SIZEOF_INT >= 4) && (LZO_SIZEOF_INT < LZO_SIZEOF_LONG)
2769 #  define lzo_int32l_t              int
2770 #  define lzo_uint32l_t             unsigned int
2771 #  define LZO_SIZEOF_LZO_INT32L_T   LZO_SIZEOF_INT
2772 #elif (LZO_SIZEOF_LONG >= 4)
2773 #  define lzo_int32l_t              long int
2774 #  define lzo_uint32l_t             unsigned long int
2775 #  define LZO_SIZEOF_LZO_INT32L_T   LZO_SIZEOF_LONG
2776 #else
2777 #  error "lzo_int32l_t"
2778 #endif
2779 #endif
2780 #if 1
2781    LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32l_t) >= 4)
2782    LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32l_t) == LZO_SIZEOF_LZO_INT32L_T)
2783 #endif
2784 #if !defined(lzo_int64l_t)
2785 #if defined(lzo_int64e_t)
2786 #  define lzo_int64l_t              lzo_int64e_t
2787 #  define lzo_uint64l_t             lzo_uint64e_t
2788 #  define LZO_SIZEOF_LZO_INT64L_T   LZO_SIZEOF_LZO_INT64E_T
2789 #else
2790 #endif
2791 #endif
2792 #if defined(lzo_int64l_t)
2793    LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64l_t) >= 8)
2794    LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64l_t) == LZO_SIZEOF_LZO_INT64L_T)
2795 #endif
2796 #if !defined(lzo_int32f_t)
2797 #if (LZO_SIZEOF_SIZE_T >= 8)
2798 #  define lzo_int32f_t              lzo_int64l_t
2799 #  define lzo_uint32f_t             lzo_uint64l_t
2800 #  define LZO_SIZEOF_LZO_INT32F_T   LZO_SIZEOF_LZO_INT64L_T
2801 #else
2802 #  define lzo_int32f_t              lzo_int32l_t
2803 #  define lzo_uint32f_t             lzo_uint32l_t
2804 #  define LZO_SIZEOF_LZO_INT32F_T   LZO_SIZEOF_LZO_INT32L_T
2805 #endif
2806 #endif
2807 #if 1
2808    LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32f_t) >= 4)
2809    LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32f_t) == LZO_SIZEOF_LZO_INT32F_T)
2810 #endif
2811 #if !defined(lzo_int64f_t)
2812 #if defined(lzo_int64l_t)
2813 #  define lzo_int64f_t              lzo_int64l_t
2814 #  define lzo_uint64f_t             lzo_uint64l_t
2815 #  define LZO_SIZEOF_LZO_INT64F_T   LZO_SIZEOF_LZO_INT64L_T
2816 #else
2817 #endif
2818 #endif
2819 #if defined(lzo_int64f_t)
2820    LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64f_t) >= 8)
2821    LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64f_t) == LZO_SIZEOF_LZO_INT64F_T)
2822 #endif
2823 #if !defined(lzo_intptr_t)
2824 #if 1 && (LZO_OS_OS400 && (LZO_SIZEOF_VOID_P == 16))
2825 #  define __LZO_INTPTR_T_IS_POINTER 1
2826    typedef char*                    lzo_intptr_t;
2827    typedef char*                    lzo_uintptr_t;
2828 #  define lzo_intptr_t              lzo_intptr_t
2829 #  define lzo_uintptr_t             lzo_uintptr_t
2830 #  define LZO_SIZEOF_LZO_INTPTR_T   LZO_SIZEOF_VOID_P
2831 #elif (LZO_CC_MSC && (_MSC_VER >= 1300) && (LZO_SIZEOF_VOID_P == 4) && (LZO_SIZEOF_INT == 4))
2832    typedef __w64 int                lzo_intptr_t;
2833    typedef __w64 unsigned int       lzo_uintptr_t;
2834 #  define lzo_intptr_t              lzo_intptr_t
2835 #  define lzo_uintptr_t             lzo_uintptr_t
2836 #  define LZO_SIZEOF_LZO_INTPTR_T   LZO_SIZEOF_INT
2837 #elif (LZO_SIZEOF_SHORT == LZO_SIZEOF_VOID_P) && (LZO_SIZEOF_INT > LZO_SIZEOF_VOID_P)
2838 #  define lzo_intptr_t              short
2839 #  define lzo_uintptr_t             unsigned short
2840 #  define LZO_SIZEOF_LZO_INTPTR_T   LZO_SIZEOF_SHORT
2841 #elif (LZO_SIZEOF_INT >= LZO_SIZEOF_VOID_P) && (LZO_SIZEOF_INT < LZO_SIZEOF_LONG)
2842 #  define lzo_intptr_t              int
2843 #  define lzo_uintptr_t             unsigned int
2844 #  define LZO_SIZEOF_LZO_INTPTR_T   LZO_SIZEOF_INT
2845 #elif (LZO_SIZEOF_LONG >= LZO_SIZEOF_VOID_P)
2846 #  define lzo_intptr_t              long
2847 #  define lzo_uintptr_t             unsigned long
2848 #  define LZO_SIZEOF_LZO_INTPTR_T   LZO_SIZEOF_LONG
2849 #elif (LZO_SIZEOF_LZO_INT64L_T >= LZO_SIZEOF_VOID_P)
2850 #  define lzo_intptr_t              lzo_int64l_t
2851 #  define lzo_uintptr_t             lzo_uint64l_t
2852 #  define LZO_SIZEOF_LZO_INTPTR_T   LZO_SIZEOF_LZO_INT64L_T
2853 #else
2854 #  error "lzo_intptr_t"
2855 #endif
2856 #endif
2857 #if 1
2858     LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_intptr_t) >= sizeof(void *))
2859     LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_intptr_t) == sizeof(lzo_uintptr_t))
2860 #endif
2861 #if !defined(lzo_word_t)
2862 #if defined(LZO_WORDSIZE) && (LZO_WORDSIZE+0 > 0)
2863 #if (LZO_WORDSIZE == LZO_SIZEOF_LZO_INTPTR_T) && !(__LZO_INTPTR_T_IS_POINTER)
2864 #  define lzo_word_t                lzo_uintptr_t
2865 #  define lzo_sword_t               lzo_intptr_t
2866 #  define LZO_SIZEOF_LZO_WORD_T LZO_SIZEOF_LZO_INTPTR_T
2867 #elif (LZO_WORDSIZE == LZO_SIZEOF_LONG)
2868 #  define lzo_word_t                unsigned long
2869 #  define lzo_sword_t               long
2870 #  define LZO_SIZEOF_LZO_WORD_T LZO_SIZEOF_LONG
2871 #elif (LZO_WORDSIZE == LZO_SIZEOF_INT)
2872 #  define lzo_word_t                unsigned int
2873 #  define lzo_sword_t               int
2874 #  define LZO_SIZEOF_LZO_WORD_T LZO_SIZEOF_INT
2875 #elif (LZO_WORDSIZE == LZO_SIZEOF_SHORT)
2876 #  define lzo_word_t                unsigned short
2877 #  define lzo_sword_t               short
2878 #  define LZO_SIZEOF_LZO_WORD_T LZO_SIZEOF_SHORT
2879 #elif (LZO_WORDSIZE == 1)
2880 #  define lzo_word_t                unsigned char
2881 #  define lzo_sword_t               signed char
2882 #  define LZO_SIZEOF_LZO_WORD_T 1
2883 #elif (LZO_WORDSIZE == LZO_SIZEOF_LZO_INT64L_T)
2884 #  define lzo_word_t                lzo_uint64l_t
2885 #  define lzo_sword_t               lzo_int64l_t
2886 #  define LZO_SIZEOF_LZO_WORD_T LZO_SIZEOF_LZO_INT64L_T
2887 #elif (LZO_ARCH_SPU) && (LZO_CC_GNUC)
2888 #if 0
2889    typedef unsigned lzo_word_t  __attribute__((__mode__(__V16QI__)));
2890    typedef int      lzo_sword_t __attribute__((__mode__(__V16QI__)));
2891 #  define lzo_word_t                lzo_word_t
2892 #  define lzo_sword_t               lzo_sword_t
2893 #  define LZO_SIZEOF_LZO_WORD_T     16
2894 #endif
2895 #else
2896 #  error "lzo_word_t"
2897 #endif
2898 #endif
2899 #endif
2900 #if 1 && defined(lzo_word_t)
2901     LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_word_t)  == LZO_WORDSIZE)
2902     LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_sword_t) == LZO_WORDSIZE)
2903 #endif
2904 #if 1
2905 #define lzo_int8_t                  signed char
2906 #define lzo_uint8_t                 unsigned char
2907 #define LZO_SIZEOF_LZO_INT8_T       1
2908 LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int8_t) == 1)
2909 LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int8_t) == sizeof(lzo_uint8_t))
2910 #endif
2911 #if defined(lzo_int16e_t)
2912 #define lzo_int16_t                 lzo_int16e_t
2913 #define lzo_uint16_t                lzo_uint16e_t
2914 #define LZO_SIZEOF_LZO_INT16_T      LZO_SIZEOF_LZO_INT16E_T
2915 LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int16_t) == 2)
2916 LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int16_t) == sizeof(lzo_uint16_t))
2917 #endif
2918 #if defined(lzo_int32e_t)
2919 #define lzo_int32_t                 lzo_int32e_t
2920 #define lzo_uint32_t                lzo_uint32e_t
2921 #define LZO_SIZEOF_LZO_INT32_T      LZO_SIZEOF_LZO_INT32E_T
2922 LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32_t) == 4)
2923 LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32_t) == sizeof(lzo_uint32_t))
2924 #endif
2925 #if defined(lzo_int64e_t)
2926 #define lzo_int64_t                 lzo_int64e_t
2927 #define lzo_uint64_t                lzo_uint64e_t
2928 #define LZO_SIZEOF_LZO_INT64_T      LZO_SIZEOF_LZO_INT64E_T
2929 LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64_t) == 8)
2930 LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64_t) == sizeof(lzo_uint64_t))
2931 #endif
2932 #if 1
2933 #define lzo_int_least32_t           lzo_int32l_t
2934 #define lzo_uint_least32_t          lzo_uint32l_t
2935 #define LZO_SIZEOF_LZO_INT_LEAST32_T LZO_SIZEOF_LZO_INT32L_T
2936 LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_least32_t) >= 4)
2937 LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_least32_t) == sizeof(lzo_uint_least32_t))
2938 #endif
2939 #if defined(lzo_int64l_t)
2940 #define lzo_int_least64_t           lzo_int64l_t
2941 #define lzo_uint_least64_t          lzo_uint64l_t
2942 #define LZO_SIZEOF_LZO_INT_LEAST64_T LZO_SIZEOF_LZO_INT64L_T
2943 LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_least64_t) >= 8)
2944 LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_least64_t) == sizeof(lzo_uint_least64_t))
2945 #endif
2946 #if 1
2947 #define lzo_int_fast32_t           lzo_int32f_t
2948 #define lzo_uint_fast32_t          lzo_uint32f_t
2949 #define LZO_SIZEOF_LZO_INT_FAST32_T LZO_SIZEOF_LZO_INT32F_T
2950 LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_fast32_t) >= 4)
2951 LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_fast32_t) == sizeof(lzo_uint_fast32_t))
2952 #endif
2953 #if defined(lzo_int64f_t)
2954 #define lzo_int_fast64_t           lzo_int64f_t
2955 #define lzo_uint_fast64_t          lzo_uint64f_t
2956 #define LZO_SIZEOF_LZO_INT_FAST64_T LZO_SIZEOF_LZO_INT64F_T
2957 LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_fast64_t) >= 8)
2958 LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_fast64_t) == sizeof(lzo_uint_fast64_t))
2959 #endif
2960 #if !defined(LZO_INT16_C)
2961 #  if (LZO_BROKEN_INTEGRAL_CONSTANTS) && (LZO_SIZEOF_INT >= 2)
2962 #    define LZO_INT16_C(c)          ((c) + 0)
2963 #    define LZO_UINT16_C(c)         ((c) + 0U)
2964 #  elif (LZO_BROKEN_INTEGRAL_CONSTANTS) && (LZO_SIZEOF_LONG >= 2)
2965 #    define LZO_INT16_C(c)          ((c) + 0L)
2966 #    define LZO_UINT16_C(c)         ((c) + 0UL)
2967 #  elif (LZO_SIZEOF_INT >= 2)
2968 #    define LZO_INT16_C(c)          (c)
2969 #    define LZO_UINT16_C(c)         (c##U)
2970 #  elif (LZO_SIZEOF_LONG >= 2)
2971 #    define LZO_INT16_C(c)          (c##L)
2972 #    define LZO_UINT16_C(c)         (c##UL)
2973 #  else
2974 #    error "LZO_INT16_C"
2975 #  endif
2976 #endif
2977 #if !defined(LZO_INT32_C)
2978 #  if (LZO_BROKEN_INTEGRAL_CONSTANTS) && (LZO_SIZEOF_INT >= 4)
2979 #    define LZO_INT32_C(c)          ((c) + 0)
2980 #    define LZO_UINT32_C(c)         ((c) + 0U)
2981 #  elif (LZO_BROKEN_INTEGRAL_CONSTANTS) && (LZO_SIZEOF_LONG >= 4)
2982 #    define LZO_INT32_C(c)          ((c) + 0L)
2983 #    define LZO_UINT32_C(c)         ((c) + 0UL)
2984 #  elif (LZO_SIZEOF_INT >= 4)
2985 #    define LZO_INT32_C(c)          (c)
2986 #    define LZO_UINT32_C(c)         (c##U)
2987 #  elif (LZO_SIZEOF_LONG >= 4)
2988 #    define LZO_INT32_C(c)          (c##L)
2989 #    define LZO_UINT32_C(c)         (c##UL)
2990 #  elif (LZO_SIZEOF_LONG_LONG >= 4)
2991 #    define LZO_INT32_C(c)          (c##LL)
2992 #    define LZO_UINT32_C(c)         (c##ULL)
2993 #  else
2994 #    error "LZO_INT32_C"
2995 #  endif
2996 #endif
2997 #if !defined(LZO_INT64_C) && defined(lzo_int64l_t)
2998 #  if (LZO_BROKEN_INTEGRAL_CONSTANTS) && (LZO_SIZEOF_INT >= 8)
2999 #    define LZO_INT64_C(c)          ((c) + 0)
3000 #    define LZO_UINT64_C(c)         ((c) + 0U)
3001 #  elif (LZO_BROKEN_INTEGRAL_CONSTANTS) && (LZO_SIZEOF_LONG >= 8)
3002 #    define LZO_INT64_C(c)          ((c) + 0L)
3003 #    define LZO_UINT64_C(c)         ((c) + 0UL)
3004 #  elif (LZO_SIZEOF_INT >= 8)
3005 #    define LZO_INT64_C(c)          (c)
3006 #    define LZO_UINT64_C(c)         (c##U)
3007 #  elif (LZO_SIZEOF_LONG >= 8)
3008 #    define LZO_INT64_C(c)          (c##L)
3009 #    define LZO_UINT64_C(c)         (c##UL)
3010 #  else
3011 #    error "LZO_INT64_C"
3012 #  endif
3013 #endif
3014 #endif
3015 
3016 #endif
3017 
3018 #endif
3019 
3020 #undef LZO_HAVE_CONFIG_H
3021 #include "minilzo.h"
3022 
3023 #if !defined(MINILZO_VERSION) || (MINILZO_VERSION != 0x2070)
3024 #  error "version mismatch in miniLZO source files"
3025 #endif
3026 
3027 #ifdef MINILZO_HAVE_CONFIG_H
3028 #  define LZO_HAVE_CONFIG_H 1
3029 #endif
3030 
3031 #ifndef __LZO_CONF_H
3032 #define __LZO_CONF_H 1
3033 
3034 #if !defined(__LZO_IN_MINILZO)
3035 #if defined(LZO_CFG_FREESTANDING) && (LZO_CFG_FREESTANDING)
3036 #  define LZO_LIBC_FREESTANDING 1
3037 #  define LZO_OS_FREESTANDING 1
3038 #endif
3039 #if defined(LZO_CFG_EXTRA_CONFIG_HEADER)
3040 #  include LZO_CFG_EXTRA_CONFIG_HEADER
3041 #endif
3042 #if defined(__LZOCONF_H) || defined(__LZOCONF_H_INCLUDED)
3043 #  error "include this file first"
3044 #endif
3045 #include "lzo/lzoconf.h"
3046 #if defined(LZO_CFG_EXTRA_CONFIG_HEADER2)
3047 #  include LZO_CFG_EXTRA_CONFIG_HEADER2
3048 #endif
3049 #endif
3050 
3051 #if (LZO_VERSION < 0x2070) || !defined(__LZOCONF_H_INCLUDED)
3052 #  error "version mismatch"
3053 #endif
3054 
3055 #if (LZO_CC_MSC && (_MSC_VER >= 1000 && _MSC_VER < 1100))
3056 #  pragma warning(disable: 4702)
3057 #endif
3058 #if (LZO_CC_MSC && (_MSC_VER >= 1000))
3059 #  pragma warning(disable: 4127 4701)
3060 #  pragma warning(disable: 4514 4710 4711)
3061 #endif
3062 #if (LZO_CC_MSC && (_MSC_VER >= 1300))
3063 #  pragma warning(disable: 4820)
3064 #endif
3065 #if (LZO_CC_MSC && (_MSC_VER >= 1800))
3066 #  pragma warning(disable: 4746)
3067 #endif
3068 
3069 #if (LZO_CC_SUNPROC)
3070 #if !defined(__cplusplus)
3071 #  pragma error_messages(off,E_END_OF_LOOP_CODE_NOT_REACHED)
3072 #  pragma error_messages(off,E_LOOP_NOT_ENTERED_AT_TOP)
3073 #  pragma error_messages(off,E_STATEMENT_NOT_REACHED)
3074 #endif
3075 #endif
3076 
3077 #if defined(__LZO_IN_MINILZO) || (LZO_CFG_FREESTANDING)
3078 #elif 1
3079 #  include <string.h>
3080 #else
3081 #  define LZO_WANT_ACC_INCD_H 1
3082 #endif
3083 #if defined(LZO_HAVE_CONFIG_H)
3084 #  define LZO_CFG_NO_CONFIG_HEADER 1
3085 #endif
3086 
3087 #if 1 && !defined(LZO_CFG_FREESTANDING)
3088 #if 1 && !defined(HAVE_STRING_H)
3089 #define HAVE_STRING_H 1
3090 #endif
3091 #if 1 && !defined(HAVE_MEMCMP)
3092 #define HAVE_MEMCMP 1
3093 #endif
3094 #if 1 && !defined(HAVE_MEMCPY)
3095 #define HAVE_MEMCPY 1
3096 #endif
3097 #if 1 && !defined(HAVE_MEMMOVE)
3098 #define HAVE_MEMMOVE 1
3099 #endif
3100 #if 1 && !defined(HAVE_MEMSET)
3101 #define HAVE_MEMSET 1
3102 #endif
3103 #endif
3104 
3105 #if 1 && defined(HAVE_STRING_H)
3106 #include <string.h>
3107 #endif
3108 
3109 #if 1 || defined(lzo_int8_t) || defined(lzo_uint8_t)
3110 LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int8_t)  == 1)
3111 LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint8_t) == 1)
3112 #endif
3113 #if 1 || defined(lzo_int16_t) || defined(lzo_uint16_t)
3114 LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int16_t)  == 2)
3115 LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint16_t) == 2)
3116 #endif
3117 #if 1 || defined(lzo_int32_t) || defined(lzo_uint32_t)
3118 LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32_t)  == 4)
3119 LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint32_t) == 4)
3120 #endif
3121 #if defined(lzo_int64_t) || defined(lzo_uint64_t)
3122 LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64_t)  == 8)
3123 LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint64_t) == 8)
3124 #endif
3125 
3126 #if (LZO_CFG_FREESTANDING)
3127 #  undef HAVE_MEMCMP
3128 #  undef HAVE_MEMCPY
3129 #  undef HAVE_MEMMOVE
3130 #  undef HAVE_MEMSET
3131 #endif
3132 
3133 #if !(HAVE_MEMCMP)
3134 #  undef memcmp
3135 #  define memcmp(a,b,c)         lzo_memcmp(a,b,c)
3136 #else
3137 #  undef lzo_memcmp
3138 #  define lzo_memcmp(a,b,c)     memcmp(a,b,c)
3139 #endif
3140 #if !(HAVE_MEMCPY)
3141 #  undef memcpy
3142 #  define memcpy(a,b,c)         lzo_memcpy(a,b,c)
3143 #else
3144 #  undef lzo_memcpy
3145 #  define lzo_memcpy(a,b,c)     memcpy(a,b,c)
3146 #endif
3147 #if !(HAVE_MEMMOVE)
3148 #  undef memmove
3149 #  define memmove(a,b,c)        lzo_memmove(a,b,c)
3150 #else
3151 #  undef lzo_memmove
3152 #  define lzo_memmove(a,b,c)    memmove(a,b,c)
3153 #endif
3154 #if !(HAVE_MEMSET)
3155 #  undef memset
3156 #  define memset(a,b,c)         lzo_memset(a,b,c)
3157 #else
3158 #  undef lzo_memset
3159 #  define lzo_memset(a,b,c)     memset(a,b,c)
3160 #endif
3161 
3162 #undef NDEBUG
3163 #if (LZO_CFG_FREESTANDING)
3164 #  undef LZO_DEBUG
3165 #  define NDEBUG 1
3166 #  undef assert
3167 #  define assert(e) ((void)0)
3168 #else
3169 #  if !defined(LZO_DEBUG)
3170 #    define NDEBUG 1
3171 #  endif
3172 #  include <assert.h>
3173 #endif
3174 
3175 #if 0 && defined(__BOUNDS_CHECKING_ON)
3176 #  include <unchecked.h>
3177 #else
3178 #  define BOUNDS_CHECKING_OFF_DURING(stmt)      stmt
3179 #  define BOUNDS_CHECKING_OFF_IN_EXPR(expr)     (expr)
3180 #endif
3181 
3182 #if (LZO_CFG_PGO)
3183 #  undef __lzo_likely
3184 #  undef __lzo_unlikely
3185 #  define __lzo_likely(e)       (e)
3186 #  define __lzo_unlikely(e)     (e)
3187 #endif
3188 
3189 #undef _
3190 #undef __
3191 #undef ___
3192 #undef ____
3193 #undef _p0
3194 #undef _p1
3195 #undef _p2
3196 #undef _p3
3197 #undef _p4
3198 #undef _s0
3199 #undef _s1
3200 #undef _s2
3201 #undef _s3
3202 #undef _s4
3203 #undef _ww
3204 
3205 #if 1
3206 #  define LZO_BYTE(x)       ((unsigned char) (x))
3207 #else
3208 #  define LZO_BYTE(x)       ((unsigned char) ((x) & 0xff))
3209 #endif
3210 
3211 #define LZO_MAX(a,b)        ((a) >= (b) ? (a) : (b))
3212 #define LZO_MIN(a,b)        ((a) <= (b) ? (a) : (b))
3213 #define LZO_MAX3(a,b,c)     ((a) >= (b) ? LZO_MAX(a,c) : LZO_MAX(b,c))
3214 #define LZO_MIN3(a,b,c)     ((a) <= (b) ? LZO_MIN(a,c) : LZO_MIN(b,c))
3215 
3216 #define lzo_sizeof(type)    ((lzo_uint) (sizeof(type)))
3217 
3218 #define LZO_HIGH(array)     ((lzo_uint) (sizeof(array)/sizeof(*(array))))
3219 
3220 #define LZO_SIZE(bits)      (1u << (bits))
3221 #define LZO_MASK(bits)      (LZO_SIZE(bits) - 1)
3222 
3223 #define LZO_USIZE(bits)     ((lzo_uint) 1 << (bits))
3224 #define LZO_UMASK(bits)     (LZO_USIZE(bits) - 1)
3225 
3226 #if !defined(DMUL)
3227 #if 0
3228 
3229 #  define DMUL(a,b) ((lzo_xint) ((lzo_uint32_t)(a) * (lzo_uint32_t)(b)))
3230 #else
3231 #  define DMUL(a,b) ((lzo_xint) ((a) * (b)))
3232 #endif
3233 #endif
3234 
3235 #ifndef __LZO_FUNC_H
3236 #define __LZO_FUNC_H 1
3237 
3238 #if !defined(LZO_BITOPS_USE_ASM_BITSCAN) && !defined(LZO_BITOPS_USE_GNUC_BITSCAN) && !defined(LZO_BITOPS_USE_MSC_BITSCAN)
3239 #if 1 && (LZO_ARCH_AMD64) && (LZO_CC_GNUC && (LZO_CC_GNUC < 0x040000ul)) && (LZO_ASM_SYNTAX_GNUC)
3240 #define LZO_BITOPS_USE_ASM_BITSCAN 1
3241 #elif (LZO_CC_CLANG || (LZO_CC_GNUC >= 0x030400ul) || (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 1000)) || (LZO_CC_LLVM && (!defined(__llvm_tools_version__) || (__llvm_tools_version__+0 >= 0x010500ul))))
3242 #define LZO_BITOPS_USE_GNUC_BITSCAN 1
3243 #elif (LZO_OS_WIN32 || LZO_OS_WIN64) && ((LZO_CC_INTELC_MSC && (__INTEL_COMPILER >= 1010)) || (LZO_CC_MSC && (_MSC_VER >= 1400)))
3244 #define LZO_BITOPS_USE_MSC_BITSCAN 1
3245 #if (LZO_CC_MSC) && (LZO_ARCH_AMD64 || LZO_ARCH_I386)
3246 #include <intrin.h>
3247 #endif
3248 #if (LZO_CC_MSC) && (LZO_ARCH_AMD64 || LZO_ARCH_I386)
3249 #pragma intrinsic(_BitScanReverse)
3250 #pragma intrinsic(_BitScanForward)
3251 #endif
3252 #if (LZO_CC_MSC) && (LZO_ARCH_AMD64)
3253 #pragma intrinsic(_BitScanReverse64)
3254 #pragma intrinsic(_BitScanForward64)
3255 #endif
3256 #endif
3257 #endif
3258 
lzo_bitops_ctlz32_func(lzo_uint32_t v)3259 __lzo_static_forceinline unsigned lzo_bitops_ctlz32_func(lzo_uint32_t v)
3260 {
3261 #if (LZO_BITOPS_USE_MSC_BITSCAN) && (LZO_ARCH_AMD64 || LZO_ARCH_I386)
3262     unsigned long r; (void) _BitScanReverse(&r, v); return (unsigned) r ^ 31;
3263 #define lzo_bitops_ctlz32(v)    lzo_bitops_ctlz32_func(v)
3264 #elif (LZO_BITOPS_USE_ASM_BITSCAN) && (LZO_ARCH_AMD64 || LZO_ARCH_I386) && (LZO_ASM_SYNTAX_GNUC)
3265     lzo_uint32_t r;
3266     __asm__("bsr %1,%0" : "=r" (r) : "rm" (v) __LZO_ASM_CLOBBER_LIST_CC);
3267     return (unsigned) r ^ 31;
3268 #define lzo_bitops_ctlz32(v)    lzo_bitops_ctlz32_func(v)
3269 #elif (LZO_BITOPS_USE_GNUC_BITSCAN) && (LZO_SIZEOF_INT == 4)
3270     unsigned r; r = (unsigned) __builtin_clz(v); return r;
3271 #define lzo_bitops_ctlz32(v)    ((unsigned) __builtin_clz(v))
3272 #else
3273     LZO_UNUSED(v); return 0;
3274 #endif
3275 }
3276 
3277 #if defined(lzo_uint64_t)
lzo_bitops_ctlz64_func(lzo_uint64_t v)3278 __lzo_static_forceinline unsigned lzo_bitops_ctlz64_func(lzo_uint64_t v)
3279 {
3280 #if (LZO_BITOPS_USE_MSC_BITSCAN) && (LZO_ARCH_AMD64)
3281     unsigned long r; (void) _BitScanReverse64(&r, v); return (unsigned) r ^ 63;
3282 #define lzo_bitops_ctlz64(v)    lzo_bitops_ctlz64_func(v)
3283 #elif (LZO_BITOPS_USE_ASM_BITSCAN) && (LZO_ARCH_AMD64) && (LZO_ASM_SYNTAX_GNUC)
3284     lzo_uint64_t r;
3285     __asm__("bsr %1,%0" : "=r" (r) : "rm" (v) __LZO_ASM_CLOBBER_LIST_CC);
3286     return (unsigned) r ^ 63;
3287 #define lzo_bitops_ctlz64(v)    lzo_bitops_ctlz64_func(v)
3288 #elif (LZO_BITOPS_USE_GNUC_BITSCAN) && (LZO_SIZEOF_LONG == 8) && (LZO_WORDSIZE >= 8)
3289     unsigned r; r = (unsigned) __builtin_clzl(v); return r;
3290 #define lzo_bitops_ctlz64(v)    ((unsigned) __builtin_clzl(v))
3291 #elif (LZO_BITOPS_USE_GNUC_BITSCAN) && (LZO_SIZEOF_LONG_LONG == 8) && (LZO_WORDSIZE >= 8)
3292     unsigned r; r = (unsigned) __builtin_clzll(v); return r;
3293 #define lzo_bitops_ctlz64(v)    ((unsigned) __builtin_clzll(v))
3294 #else
3295     LZO_UNUSED(v); return 0;
3296 #endif
3297 }
3298 #endif
3299 
lzo_bitops_cttz32_func(lzo_uint32_t v)3300 __lzo_static_forceinline unsigned lzo_bitops_cttz32_func(lzo_uint32_t v)
3301 {
3302 #if (LZO_BITOPS_USE_MSC_BITSCAN) && (LZO_ARCH_AMD64 || LZO_ARCH_I386)
3303     unsigned long r; (void) _BitScanForward(&r, v); return (unsigned) r;
3304 #define lzo_bitops_cttz32(v)    lzo_bitops_cttz32_func(v)
3305 #elif (LZO_BITOPS_USE_ASM_BITSCAN) && (LZO_ARCH_AMD64 || LZO_ARCH_I386) && (LZO_ASM_SYNTAX_GNUC)
3306     lzo_uint32_t r;
3307     __asm__("bsf %1,%0" : "=r" (r) : "rm" (v) __LZO_ASM_CLOBBER_LIST_CC);
3308     return (unsigned) r;
3309 #define lzo_bitops_cttz32(v)    lzo_bitops_cttz32_func(v)
3310 #elif (LZO_BITOPS_USE_GNUC_BITSCAN) && (LZO_SIZEOF_INT >= 4)
3311     unsigned r; r = (unsigned) __builtin_ctz(v); return r;
3312 #define lzo_bitops_cttz32(v)    ((unsigned) __builtin_ctz(v))
3313 #else
3314     LZO_UNUSED(v); return 0;
3315 #endif
3316 }
3317 
3318 #if defined(lzo_uint64_t)
lzo_bitops_cttz64_func(lzo_uint64_t v)3319 __lzo_static_forceinline unsigned lzo_bitops_cttz64_func(lzo_uint64_t v)
3320 {
3321 #if (LZO_BITOPS_USE_MSC_BITSCAN) && (LZO_ARCH_AMD64)
3322     unsigned long r; (void) _BitScanForward64(&r, v); return (unsigned) r;
3323 #define lzo_bitops_cttz64(v)    lzo_bitops_cttz64_func(v)
3324 #elif (LZO_BITOPS_USE_ASM_BITSCAN) && (LZO_ARCH_AMD64) && (LZO_ASM_SYNTAX_GNUC)
3325     lzo_uint64_t r;
3326     __asm__("bsf %1,%0" : "=r" (r) : "rm" (v) __LZO_ASM_CLOBBER_LIST_CC);
3327     return (unsigned) r;
3328 #define lzo_bitops_cttz64(v)    lzo_bitops_cttz64_func(v)
3329 #elif (LZO_BITOPS_USE_GNUC_BITSCAN) && (LZO_SIZEOF_LONG >= 8) && (LZO_WORDSIZE >= 8)
3330     unsigned r; r = (unsigned) __builtin_ctzl(v); return r;
3331 #define lzo_bitops_cttz64(v)    ((unsigned) __builtin_ctzl(v))
3332 #elif (LZO_BITOPS_USE_GNUC_BITSCAN) && (LZO_SIZEOF_LONG_LONG >= 8) && (LZO_WORDSIZE >= 8)
3333     unsigned r; r = (unsigned) __builtin_ctzll(v); return r;
3334 #define lzo_bitops_cttz64(v)    ((unsigned) __builtin_ctzll(v))
3335 #else
3336     LZO_UNUSED(v); return 0;
3337 #endif
3338 }
3339 #endif
3340 
3341 #if 1 && (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || (LZO_CC_GNUC >= 0x020700ul) || LZO_CC_INTELC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || LZO_CC_PGI)
3342 static void __attribute__((__unused__))
3343 #else
3344 __lzo_static_forceinline void
3345 #endif
lzo_bitops_unused_funcs(void)3346 lzo_bitops_unused_funcs(void)
3347 {
3348     LZO_UNUSED_FUNC(lzo_bitops_ctlz32_func);
3349     LZO_UNUSED_FUNC(lzo_bitops_cttz32_func);
3350 #if defined(lzo_uint64_t)
3351     LZO_UNUSED_FUNC(lzo_bitops_ctlz64_func);
3352     LZO_UNUSED_FUNC(lzo_bitops_cttz64_func);
3353 #endif
3354     LZO_UNUSED_FUNC(lzo_bitops_unused_funcs);
3355 }
3356 
3357 #if defined(__lzo_alignof) && !(LZO_CFG_NO_UNALIGNED)
3358 #ifndef __lzo_memops_tcheck
3359 #define __lzo_memops_tcheck(t,a,b) ((void)0, sizeof(t) == (a) && __lzo_alignof(t) == (b))
3360 #endif
3361 #endif
3362 #ifndef lzo_memops_TU0p
3363 #define lzo_memops_TU0p void __LZO_MMODEL *
3364 #endif
3365 #ifndef lzo_memops_TU1p
3366 #define lzo_memops_TU1p unsigned char __LZO_MMODEL *
3367 #endif
3368 #ifndef lzo_memops_TU2p
3369 #if (LZO_OPT_UNALIGNED16)
3370 typedef lzo_uint16_t __lzo_may_alias lzo_memops_TU2;
3371 #define lzo_memops_TU2p volatile lzo_memops_TU2 *
3372 #elif defined(__lzo_byte_struct)
3373 __lzo_byte_struct(lzo_memops_TU2_struct,2)
3374 typedef struct lzo_memops_TU2_struct lzo_memops_TU2;
3375 #else
3376 struct lzo_memops_TU2_struct { unsigned char a[2]; } __lzo_may_alias;
3377 typedef struct lzo_memops_TU2_struct lzo_memops_TU2;
3378 #endif
3379 #ifndef lzo_memops_TU2p
3380 #define lzo_memops_TU2p lzo_memops_TU2 *
3381 #endif
3382 #endif
3383 #ifndef lzo_memops_TU4p
3384 #if (LZO_OPT_UNALIGNED32)
3385 typedef lzo_uint32_t __lzo_may_alias lzo_memops_TU4;
3386 #define lzo_memops_TU4p volatile lzo_memops_TU4 __LZO_MMODEL *
3387 #elif defined(__lzo_byte_struct)
3388 __lzo_byte_struct(lzo_memops_TU4_struct,4)
3389 typedef struct lzo_memops_TU4_struct lzo_memops_TU4;
3390 #else
3391 struct lzo_memops_TU4_struct { unsigned char a[4]; } __lzo_may_alias;
3392 typedef struct lzo_memops_TU4_struct lzo_memops_TU4;
3393 #endif
3394 #ifndef lzo_memops_TU4p
3395 #define lzo_memops_TU4p lzo_memops_TU4 __LZO_MMODEL *
3396 #endif
3397 #endif
3398 #ifndef lzo_memops_TU8p
3399 #if (LZO_OPT_UNALIGNED64)
3400 typedef lzo_uint64_t __lzo_may_alias lzo_memops_TU8;
3401 #define lzo_memops_TU8p volatile lzo_memops_TU8 __LZO_MMODEL *
3402 #elif defined(__lzo_byte_struct)
3403 __lzo_byte_struct(lzo_memops_TU8_struct,8)
3404 typedef struct lzo_memops_TU8_struct lzo_memops_TU8;
3405 #else
3406 struct lzo_memops_TU8_struct { unsigned char a[8]; } __lzo_may_alias;
3407 typedef struct lzo_memops_TU8_struct lzo_memops_TU8;
3408 #endif
3409 #ifndef lzo_memops_TU8p
3410 #define lzo_memops_TU8p lzo_memops_TU8 __LZO_MMODEL *
3411 #endif
3412 #endif
3413 #ifndef lzo_memops_set_TU1p
3414 #define lzo_memops_set_TU1p     volatile lzo_memops_TU1p
3415 #endif
3416 #ifndef lzo_memops_move_TU1p
3417 #define lzo_memops_move_TU1p    lzo_memops_TU1p
3418 #endif
3419 #define LZO_MEMOPS_SET1(dd,cc) \
3420     LZO_BLOCK_BEGIN \
3421     lzo_memops_set_TU1p d__1 = (lzo_memops_set_TU1p) (lzo_memops_TU0p) (dd); \
3422     d__1[0] = LZO_BYTE(cc); \
3423     LZO_BLOCK_END
3424 #define LZO_MEMOPS_SET2(dd,cc) \
3425     LZO_BLOCK_BEGIN \
3426     lzo_memops_set_TU1p d__2 = (lzo_memops_set_TU1p) (lzo_memops_TU0p) (dd); \
3427     d__2[0] = LZO_BYTE(cc); d__2[1] = LZO_BYTE(cc); \
3428     LZO_BLOCK_END
3429 #define LZO_MEMOPS_SET3(dd,cc) \
3430     LZO_BLOCK_BEGIN \
3431     lzo_memops_set_TU1p d__3 = (lzo_memops_set_TU1p) (lzo_memops_TU0p) (dd); \
3432     d__3[0] = LZO_BYTE(cc); d__3[1] = LZO_BYTE(cc); d__3[2] = LZO_BYTE(cc); \
3433     LZO_BLOCK_END
3434 #define LZO_MEMOPS_SET4(dd,cc) \
3435     LZO_BLOCK_BEGIN \
3436     lzo_memops_set_TU1p d__4 = (lzo_memops_set_TU1p) (lzo_memops_TU0p) (dd); \
3437     d__4[0] = LZO_BYTE(cc); d__4[1] = LZO_BYTE(cc); d__4[2] = LZO_BYTE(cc); d__4[3] = LZO_BYTE(cc); \
3438     LZO_BLOCK_END
3439 #define LZO_MEMOPS_MOVE1(dd,ss) \
3440     LZO_BLOCK_BEGIN \
3441     lzo_memops_move_TU1p d__1 = (lzo_memops_move_TU1p) (lzo_memops_TU0p) (dd); \
3442     const lzo_memops_move_TU1p s__1 = (const lzo_memops_move_TU1p) (const lzo_memops_TU0p) (ss); \
3443     d__1[0] = s__1[0]; \
3444     LZO_BLOCK_END
3445 #define LZO_MEMOPS_MOVE2(dd,ss) \
3446     LZO_BLOCK_BEGIN \
3447     lzo_memops_move_TU1p d__2 = (lzo_memops_move_TU1p) (lzo_memops_TU0p) (dd); \
3448     const lzo_memops_move_TU1p s__2 = (const lzo_memops_move_TU1p) (const lzo_memops_TU0p) (ss); \
3449     d__2[0] = s__2[0]; d__2[1] = s__2[1]; \
3450     LZO_BLOCK_END
3451 #define LZO_MEMOPS_MOVE3(dd,ss) \
3452     LZO_BLOCK_BEGIN \
3453     lzo_memops_move_TU1p d__3 = (lzo_memops_move_TU1p) (lzo_memops_TU0p) (dd); \
3454     const lzo_memops_move_TU1p s__3 = (const lzo_memops_move_TU1p) (const lzo_memops_TU0p) (ss); \
3455     d__3[0] = s__3[0]; d__3[1] = s__3[1]; d__3[2] = s__3[2]; \
3456     LZO_BLOCK_END
3457 #define LZO_MEMOPS_MOVE4(dd,ss) \
3458     LZO_BLOCK_BEGIN \
3459     lzo_memops_move_TU1p d__4 = (lzo_memops_move_TU1p) (lzo_memops_TU0p) (dd); \
3460     const lzo_memops_move_TU1p s__4 = (const lzo_memops_move_TU1p) (const lzo_memops_TU0p) (ss); \
3461     d__4[0] = s__4[0]; d__4[1] = s__4[1]; d__4[2] = s__4[2]; d__4[3] = s__4[3]; \
3462     LZO_BLOCK_END
3463 #define LZO_MEMOPS_MOVE8(dd,ss) \
3464     LZO_BLOCK_BEGIN \
3465     lzo_memops_move_TU1p d__8 = (lzo_memops_move_TU1p) (lzo_memops_TU0p) (dd); \
3466     const lzo_memops_move_TU1p s__8 = (const lzo_memops_move_TU1p) (const lzo_memops_TU0p) (ss); \
3467     d__8[0] = s__8[0]; d__8[1] = s__8[1]; d__8[2] = s__8[2]; d__8[3] = s__8[3]; \
3468     d__8[4] = s__8[4]; d__8[5] = s__8[5]; d__8[6] = s__8[6]; d__8[7] = s__8[7]; \
3469     LZO_BLOCK_END
3470 LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(*(lzo_memops_TU1p)0)==1)
3471 #define LZO_MEMOPS_COPY1(dd,ss) LZO_MEMOPS_MOVE1(dd,ss)
3472 #if (LZO_OPT_UNALIGNED16)
3473 LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(*(lzo_memops_TU2p)0)==2)
3474 #define LZO_MEMOPS_COPY2(dd,ss) \
3475     * (lzo_memops_TU2p) (lzo_memops_TU0p) (dd) = * (const lzo_memops_TU2p) (const lzo_memops_TU0p) (ss)
3476 #elif defined(__lzo_memops_tcheck)
3477 #define LZO_MEMOPS_COPY2(dd,ss) \
3478     LZO_BLOCK_BEGIN if (__lzo_memops_tcheck(lzo_memops_TU2,2,1)) { \
3479         * (lzo_memops_TU2p) (lzo_memops_TU0p) (dd) = * (const lzo_memops_TU2p) (const lzo_memops_TU0p) (ss); \
3480     } else { LZO_MEMOPS_MOVE2(dd,ss); } LZO_BLOCK_END
3481 #else
3482 #define LZO_MEMOPS_COPY2(dd,ss) LZO_MEMOPS_MOVE2(dd,ss)
3483 #endif
3484 #if (LZO_OPT_UNALIGNED32)
3485 LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(*(lzo_memops_TU4p)0)==4)
3486 #define LZO_MEMOPS_COPY4(dd,ss) \
3487     * (lzo_memops_TU4p) (lzo_memops_TU0p) (dd) = * (const lzo_memops_TU4p) (const lzo_memops_TU0p) (ss)
3488 #elif defined(__lzo_memops_tcheck)
3489 #define LZO_MEMOPS_COPY4(dd,ss) \
3490     LZO_BLOCK_BEGIN if (__lzo_memops_tcheck(lzo_memops_TU4,4,1)) { \
3491         * (lzo_memops_TU4p) (lzo_memops_TU0p) (dd) = * (const lzo_memops_TU4p) (const lzo_memops_TU0p) (ss); \
3492     } else { LZO_MEMOPS_MOVE4(dd,ss); } LZO_BLOCK_END
3493 #else
3494 #define LZO_MEMOPS_COPY4(dd,ss) LZO_MEMOPS_MOVE4(dd,ss)
3495 #endif
3496 #if (LZO_WORDSIZE != 8)
3497 #define LZO_MEMOPS_COPY8(dd,ss) \
3498     LZO_BLOCK_BEGIN LZO_MEMOPS_COPY4(dd,ss); LZO_MEMOPS_COPY4((lzo_memops_TU1p)(lzo_memops_TU0p)(dd)+4,(const lzo_memops_TU1p)(const lzo_memops_TU0p)(ss)+4); LZO_BLOCK_END
3499 #else
3500 #if (LZO_OPT_UNALIGNED64)
3501 LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(*(lzo_memops_TU8p)0)==8)
3502 #define LZO_MEMOPS_COPY8(dd,ss) \
3503     * (lzo_memops_TU8p) (lzo_memops_TU0p) (dd) = * (const lzo_memops_TU8p) (const lzo_memops_TU0p) (ss)
3504 #elif (LZO_OPT_UNALIGNED32)
3505 #define LZO_MEMOPS_COPY8(dd,ss) \
3506     LZO_BLOCK_BEGIN LZO_MEMOPS_COPY4(dd,ss); LZO_MEMOPS_COPY4((lzo_memops_TU1p)(lzo_memops_TU0p)(dd)+4,(const lzo_memops_TU1p)(const lzo_memops_TU0p)(ss)+4); LZO_BLOCK_END
3507 #elif defined(__lzo_memops_tcheck)
3508 #define LZO_MEMOPS_COPY8(dd,ss) \
3509     LZO_BLOCK_BEGIN if (__lzo_memops_tcheck(lzo_memops_TU8,8,1)) { \
3510         * (lzo_memops_TU8p) (lzo_memops_TU0p) (dd) = * (const lzo_memops_TU8p) (const lzo_memops_TU0p) (ss); \
3511     } else { LZO_MEMOPS_MOVE8(dd,ss); } LZO_BLOCK_END
3512 #else
3513 #define LZO_MEMOPS_COPY8(dd,ss) LZO_MEMOPS_MOVE8(dd,ss)
3514 #endif
3515 #endif
3516 #define LZO_MEMOPS_COPYN(dd,ss,nn) \
3517     LZO_BLOCK_BEGIN \
3518     lzo_memops_TU1p d__n = (lzo_memops_TU1p) (lzo_memops_TU0p) (dd); \
3519     const lzo_memops_TU1p s__n = (const lzo_memops_TU1p) (const lzo_memops_TU0p) (ss); \
3520     lzo_uint n__n = (nn); \
3521     while ((void)0, n__n >= 8) { LZO_MEMOPS_COPY8(d__n, s__n); d__n += 8; s__n += 8; n__n -= 8; } \
3522     if ((void)0, n__n >= 4) { LZO_MEMOPS_COPY4(d__n, s__n); d__n += 4; s__n += 4; n__n -= 4; } \
3523     if ((void)0, n__n > 0) do { *d__n++ = *s__n++; } while (--n__n > 0); \
3524     LZO_BLOCK_END
3525 
lzo_memops_get_le16(const lzo_voidp ss)3526 __lzo_static_forceinline lzo_uint16_t lzo_memops_get_le16(const lzo_voidp ss)
3527 {
3528     lzo_uint16_t v;
3529 #if (LZO_ABI_LITTLE_ENDIAN)
3530     LZO_MEMOPS_COPY2(&v, ss);
3531 #elif (LZO_OPT_UNALIGNED16 && LZO_ARCH_POWERPC && LZO_ABI_BIG_ENDIAN) && (LZO_ASM_SYNTAX_GNUC)
3532     const lzo_memops_TU2p s = (const lzo_memops_TU2p) ss;
3533     unsigned long vv;
3534     __asm__("lhbrx %0,0,%1" : "=r" (vv) : "r" (s), "m" (*s));
3535     v = (lzo_uint16_t) vv;
3536 #else
3537     const lzo_memops_TU1p s = (const lzo_memops_TU1p) ss;
3538     v = (lzo_uint16_t) (((lzo_uint16_t)s[0]) | ((lzo_uint16_t)s[1] << 8));
3539 #endif
3540     return v;
3541 }
3542 #if (LZO_OPT_UNALIGNED16) && (LZO_ABI_LITTLE_ENDIAN)
3543 #define LZO_MEMOPS_GET_LE16(ss)    * (const lzo_memops_TU2p) (const lzo_memops_TU0p) (ss)
3544 #else
3545 #define LZO_MEMOPS_GET_LE16(ss)    lzo_memops_get_le16(ss)
3546 #endif
3547 
lzo_memops_get_le32(const lzo_voidp ss)3548 __lzo_static_forceinline lzo_uint32_t lzo_memops_get_le32(const lzo_voidp ss)
3549 {
3550     lzo_uint32_t v;
3551 #if (LZO_ABI_LITTLE_ENDIAN)
3552     LZO_MEMOPS_COPY4(&v, ss);
3553 #elif (LZO_OPT_UNALIGNED32 && LZO_ARCH_POWERPC && LZO_ABI_BIG_ENDIAN) && (LZO_ASM_SYNTAX_GNUC)
3554     const lzo_memops_TU4p s = (const lzo_memops_TU4p) ss;
3555     unsigned long vv;
3556     __asm__("lwbrx %0,0,%1" : "=r" (vv) : "r" (s), "m" (*s));
3557     v = (lzo_uint32_t) vv;
3558 #else
3559     const lzo_memops_TU1p s = (const lzo_memops_TU1p) ss;
3560     v = (lzo_uint32_t) (((lzo_uint32_t)s[0] << 24) | ((lzo_uint32_t)s[1] << 16) | ((lzo_uint32_t)s[2] << 8) | ((lzo_uint32_t)s[3]));
3561 #endif
3562     return v;
3563 }
3564 #if (LZO_OPT_UNALIGNED32) && (LZO_ABI_LITTLE_ENDIAN)
3565 #define LZO_MEMOPS_GET_LE32(ss)    * (const lzo_memops_TU4p) (const lzo_memops_TU0p) (ss)
3566 #else
3567 #define LZO_MEMOPS_GET_LE32(ss)    lzo_memops_get_le32(ss)
3568 #endif
3569 
3570 #if (LZO_OPT_UNALIGNED64) && (LZO_ABI_LITTLE_ENDIAN)
3571 #define LZO_MEMOPS_GET_LE64(ss)    * (const lzo_memops_TU8p) (const lzo_memops_TU0p) (ss)
3572 #endif
3573 
lzo_memops_get_ne16(const lzo_voidp ss)3574 __lzo_static_forceinline lzo_uint16_t lzo_memops_get_ne16(const lzo_voidp ss)
3575 {
3576     lzo_uint16_t v;
3577     LZO_MEMOPS_COPY2(&v, ss);
3578     return v;
3579 }
3580 #if (LZO_OPT_UNALIGNED16)
3581 #define LZO_MEMOPS_GET_NE16(ss)    * (const lzo_memops_TU2p) (const lzo_memops_TU0p) (ss)
3582 #else
3583 #define LZO_MEMOPS_GET_NE16(ss)    lzo_memops_get_ne16(ss)
3584 #endif
3585 
lzo_memops_get_ne32(const lzo_voidp ss)3586 __lzo_static_forceinline lzo_uint32_t lzo_memops_get_ne32(const lzo_voidp ss)
3587 {
3588     lzo_uint32_t v;
3589     LZO_MEMOPS_COPY4(&v, ss);
3590     return v;
3591 }
3592 #if (LZO_OPT_UNALIGNED32)
3593 #define LZO_MEMOPS_GET_NE32(ss)    * (const lzo_memops_TU4p) (const lzo_memops_TU0p) (ss)
3594 #else
3595 #define LZO_MEMOPS_GET_NE32(ss)    lzo_memops_get_ne32(ss)
3596 #endif
3597 
3598 #if (LZO_OPT_UNALIGNED64)
3599 #define LZO_MEMOPS_GET_NE64(ss)    * (const lzo_memops_TU8p) (const lzo_memops_TU0p) (ss)
3600 #endif
3601 
lzo_memops_put_le16(lzo_voidp dd,lzo_uint16_t vv)3602 __lzo_static_forceinline void lzo_memops_put_le16(lzo_voidp dd, lzo_uint16_t vv)
3603 {
3604 #if (LZO_ABI_LITTLE_ENDIAN)
3605     LZO_MEMOPS_COPY2(dd, &vv);
3606 #elif (LZO_OPT_UNALIGNED16 && LZO_ARCH_POWERPC && LZO_ABI_BIG_ENDIAN) && (LZO_ASM_SYNTAX_GNUC)
3607     lzo_memops_TU2p d = (lzo_memops_TU2p) dd;
3608     unsigned long v = vv;
3609     __asm__("sthbrx %2,0,%1" : "=m" (*d) : "r" (d), "r" (v));
3610 #else
3611     lzo_memops_TU1p d = (lzo_memops_TU1p) dd;
3612     d[0] = LZO_BYTE((vv      ) & 0xff);
3613     d[1] = LZO_BYTE((vv >>  8) & 0xff);
3614 #endif
3615 }
3616 #if (LZO_OPT_UNALIGNED16) && (LZO_ABI_LITTLE_ENDIAN)
3617 #define LZO_MEMOPS_PUT_LE16(dd,vv) (* (lzo_memops_TU2p) (lzo_memops_TU0p) (dd) = (vv))
3618 #else
3619 #define LZO_MEMOPS_PUT_LE16(dd,vv) lzo_memops_put_le16(dd,vv)
3620 #endif
3621 
lzo_memops_put_le32(lzo_voidp dd,lzo_uint32_t vv)3622 __lzo_static_forceinline void lzo_memops_put_le32(lzo_voidp dd, lzo_uint32_t vv)
3623 {
3624 #if (LZO_ABI_LITTLE_ENDIAN)
3625     LZO_MEMOPS_COPY4(dd, &vv);
3626 #elif (LZO_OPT_UNALIGNED32 && LZO_ARCH_POWERPC && LZO_ABI_BIG_ENDIAN) && (LZO_ASM_SYNTAX_GNUC)
3627     lzo_memops_TU4p d = (lzo_memops_TU4p) dd;
3628     unsigned long v = vv;
3629     __asm__("stwbrx %2,0,%1" : "=m" (*d) : "r" (d), "r" (v));
3630 #else
3631     lzo_memops_TU1p d = (lzo_memops_TU1p) dd;
3632     d[0] = LZO_BYTE((vv      ) & 0xff);
3633     d[1] = LZO_BYTE((vv >>  8) & 0xff);
3634     d[2] = LZO_BYTE((vv >> 16) & 0xff);
3635     d[3] = LZO_BYTE((vv >> 24) & 0xff);
3636 #endif
3637 }
3638 #if (LZO_OPT_UNALIGNED32) && (LZO_ABI_LITTLE_ENDIAN)
3639 #define LZO_MEMOPS_PUT_LE32(dd,vv) (* (lzo_memops_TU4p) (lzo_memops_TU0p) (dd) = (vv))
3640 #else
3641 #define LZO_MEMOPS_PUT_LE32(dd,vv) lzo_memops_put_le32(dd,vv)
3642 #endif
3643 
lzo_memops_put_ne16(lzo_voidp dd,lzo_uint16_t vv)3644 __lzo_static_forceinline void lzo_memops_put_ne16(lzo_voidp dd, lzo_uint16_t vv)
3645 {
3646     LZO_MEMOPS_COPY2(dd, &vv);
3647 }
3648 #if (LZO_OPT_UNALIGNED16)
3649 #define LZO_MEMOPS_PUT_NE16(dd,vv) (* (lzo_memops_TU2p) (lzo_memops_TU0p) (dd) = (vv))
3650 #else
3651 #define LZO_MEMOPS_PUT_NE16(dd,vv) lzo_memops_put_ne16(dd,vv)
3652 #endif
3653 
lzo_memops_put_ne32(lzo_voidp dd,lzo_uint32_t vv)3654 __lzo_static_forceinline void lzo_memops_put_ne32(lzo_voidp dd, lzo_uint32_t vv)
3655 {
3656     LZO_MEMOPS_COPY4(dd, &vv);
3657 }
3658 #if (LZO_OPT_UNALIGNED32)
3659 #define LZO_MEMOPS_PUT_NE32(dd,vv) (* (lzo_memops_TU4p) (lzo_memops_TU0p) (dd) = (vv))
3660 #else
3661 #define LZO_MEMOPS_PUT_NE32(dd,vv) lzo_memops_put_ne32(dd,vv)
3662 #endif
3663 
3664 #if 1 && (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || (LZO_CC_GNUC >= 0x020700ul) || LZO_CC_INTELC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || LZO_CC_PGI)
3665 static void __attribute__((__unused__))
3666 #else
3667 __lzo_static_forceinline void
3668 #endif
lzo_memops_unused_funcs(void)3669 lzo_memops_unused_funcs(void)
3670 {
3671     LZO_UNUSED_FUNC(lzo_memops_get_le16);
3672     LZO_UNUSED_FUNC(lzo_memops_get_le32);
3673     LZO_UNUSED_FUNC(lzo_memops_get_ne16);
3674     LZO_UNUSED_FUNC(lzo_memops_get_ne32);
3675     LZO_UNUSED_FUNC(lzo_memops_put_le16);
3676     LZO_UNUSED_FUNC(lzo_memops_put_le32);
3677     LZO_UNUSED_FUNC(lzo_memops_put_ne16);
3678     LZO_UNUSED_FUNC(lzo_memops_put_ne32);
3679     LZO_UNUSED_FUNC(lzo_memops_unused_funcs);
3680 }
3681 
3682 #endif
3683 
3684 #ifndef UA_SET1
3685 #define UA_SET1             LZO_MEMOPS_SET1
3686 #endif
3687 #ifndef UA_SET2
3688 #define UA_SET2             LZO_MEMOPS_SET2
3689 #endif
3690 #ifndef UA_SET3
3691 #define UA_SET3             LZO_MEMOPS_SET3
3692 #endif
3693 #ifndef UA_SET4
3694 #define UA_SET4             LZO_MEMOPS_SET4
3695 #endif
3696 #ifndef UA_MOVE1
3697 #define UA_MOVE1            LZO_MEMOPS_MOVE1
3698 #endif
3699 #ifndef UA_MOVE2
3700 #define UA_MOVE2            LZO_MEMOPS_MOVE2
3701 #endif
3702 #ifndef UA_MOVE3
3703 #define UA_MOVE3            LZO_MEMOPS_MOVE3
3704 #endif
3705 #ifndef UA_MOVE4
3706 #define UA_MOVE4            LZO_MEMOPS_MOVE4
3707 #endif
3708 #ifndef UA_MOVE8
3709 #define UA_MOVE8            LZO_MEMOPS_MOVE8
3710 #endif
3711 #ifndef UA_COPY1
3712 #define UA_COPY1            LZO_MEMOPS_COPY1
3713 #endif
3714 #ifndef UA_COPY2
3715 #define UA_COPY2            LZO_MEMOPS_COPY2
3716 #endif
3717 #ifndef UA_COPY3
3718 #define UA_COPY3            LZO_MEMOPS_COPY3
3719 #endif
3720 #ifndef UA_COPY4
3721 #define UA_COPY4            LZO_MEMOPS_COPY4
3722 #endif
3723 #ifndef UA_COPY8
3724 #define UA_COPY8            LZO_MEMOPS_COPY8
3725 #endif
3726 #ifndef UA_COPYN
3727 #define UA_COPYN            LZO_MEMOPS_COPYN
3728 #endif
3729 #ifndef UA_COPYN_X
3730 #define UA_COPYN_X          LZO_MEMOPS_COPYN
3731 #endif
3732 #ifndef UA_GET_LE16
3733 #define UA_GET_LE16         LZO_MEMOPS_GET_LE16
3734 #endif
3735 #ifndef UA_GET_LE32
3736 #define UA_GET_LE32         LZO_MEMOPS_GET_LE32
3737 #endif
3738 #ifdef LZO_MEMOPS_GET_LE64
3739 #ifndef UA_GET_LE64
3740 #define UA_GET_LE64         LZO_MEMOPS_GET_LE64
3741 #endif
3742 #endif
3743 #ifndef UA_GET_NE16
3744 #define UA_GET_NE16         LZO_MEMOPS_GET_NE16
3745 #endif
3746 #ifndef UA_GET_NE32
3747 #define UA_GET_NE32         LZO_MEMOPS_GET_NE32
3748 #endif
3749 #ifdef LZO_MEMOPS_GET_NE64
3750 #ifndef UA_GET_NE64
3751 #define UA_GET_NE64         LZO_MEMOPS_GET_NE64
3752 #endif
3753 #endif
3754 #ifndef UA_PUT_LE16
3755 #define UA_PUT_LE16         LZO_MEMOPS_PUT_LE16
3756 #endif
3757 #ifndef UA_PUT_LE32
3758 #define UA_PUT_LE32         LZO_MEMOPS_PUT_LE32
3759 #endif
3760 #ifndef UA_PUT_NE16
3761 #define UA_PUT_NE16         LZO_MEMOPS_PUT_NE16
3762 #endif
3763 #ifndef UA_PUT_NE32
3764 #define UA_PUT_NE32         LZO_MEMOPS_PUT_NE32
3765 #endif
3766 
3767 #define MEMCPY8_DS(dest,src,len) \
3768     lzo_memcpy(dest,src,len); dest += len; src += len
3769 
3770 #define BZERO8_PTR(s,l,n) \
3771     lzo_memset((lzo_voidp)(s),0,(lzo_uint)(l)*(n))
3772 
3773 #define MEMCPY_DS(dest,src,len) \
3774     do *dest++ = *src++; while (--len > 0)
3775 
3776 LZO_EXTERN(const lzo_bytep) lzo_copyright(void);
3777 
3778 #ifndef __LZO_PTR_H
3779 #define __LZO_PTR_H 1
3780 
3781 #ifdef __cplusplus
3782 extern "C" {
3783 #endif
3784 
3785 #if (LZO_ARCH_I086)
3786 #error "LZO_ARCH_I086 is unsupported"
3787 #elif (LZO_MM_PVP)
3788 #error "LZO_MM_PVP is unsupported"
3789 #else
3790 #define PTR(a)              ((lzo_uintptr_t) (a))
3791 #define PTR_LINEAR(a)       PTR(a)
3792 #define PTR_ALIGNED_4(a)    ((PTR_LINEAR(a) & 3) == 0)
3793 #define PTR_ALIGNED_8(a)    ((PTR_LINEAR(a) & 7) == 0)
3794 #define PTR_ALIGNED2_4(a,b) (((PTR_LINEAR(a) | PTR_LINEAR(b)) & 3) == 0)
3795 #define PTR_ALIGNED2_8(a,b) (((PTR_LINEAR(a) | PTR_LINEAR(b)) & 7) == 0)
3796 #endif
3797 
3798 #define PTR_LT(a,b)         (PTR(a) < PTR(b))
3799 #define PTR_GE(a,b)         (PTR(a) >= PTR(b))
3800 #define PTR_DIFF(a,b)       (PTR(a) - PTR(b))
3801 #define pd(a,b)             ((lzo_uint) ((a)-(b)))
3802 
3803 LZO_EXTERN(lzo_uintptr_t)
3804 __lzo_ptr_linear(const lzo_voidp ptr);
3805 
3806 typedef union
3807 {
3808     char            a_char;
3809     unsigned char   a_uchar;
3810     short           a_short;
3811     unsigned short  a_ushort;
3812     int             a_int;
3813     unsigned int    a_uint;
3814     long            a_long;
3815     unsigned long   a_ulong;
3816     lzo_int         a_lzo_int;
3817     lzo_uint        a_lzo_uint;
3818     lzo_xint        a_lzo_xint;
3819     lzo_int16_t     a_lzo_int16_t;
3820     lzo_uint16_t    a_lzo_uint16_t;
3821     lzo_int32_t     a_lzo_int32_t;
3822     lzo_uint32_t    a_lzo_uint32_t;
3823 #if defined(lzo_uint64_t)
3824     lzo_int64_t     a_lzo_int64_t;
3825     lzo_uint64_t    a_lzo_uint64_t;
3826 #endif
3827     size_t          a_size_t;
3828     ptrdiff_t       a_ptrdiff_t;
3829     lzo_uintptr_t   a_lzo_uintptr_t;
3830     void *          a_void_p;
3831     char *          a_char_p;
3832     unsigned char * a_uchar_p;
3833     const void *          a_c_void_p;
3834     const char *          a_c_char_p;
3835     const unsigned char * a_c_uchar_p;
3836     lzo_voidp       a_lzo_voidp;
3837     lzo_bytep       a_lzo_bytep;
3838     const lzo_voidp a_c_lzo_voidp;
3839     const lzo_bytep a_c_lzo_bytep;
3840 }
3841 lzo_full_align_t;
3842 
3843 #ifdef __cplusplus
3844 }
3845 #endif
3846 
3847 #endif
3848 
3849 #ifndef LZO_DETERMINISTIC
3850 #define LZO_DETERMINISTIC 1
3851 #endif
3852 
3853 #ifndef LZO_DICT_USE_PTR
3854 #define LZO_DICT_USE_PTR 1
3855 #endif
3856 
3857 #if (LZO_DICT_USE_PTR)
3858 #  define lzo_dict_t    const lzo_bytep
3859 #  define lzo_dict_p    lzo_dict_t *
3860 #else
3861 #  define lzo_dict_t    lzo_uint
3862 #  define lzo_dict_p    lzo_dict_t *
3863 #endif
3864 
3865 #endif
3866 
3867 #if !defined(MINILZO_CFG_SKIP_LZO_PTR)
3868 
3869 LZO_PUBLIC(lzo_uintptr_t)
__lzo_ptr_linear(const lzo_voidp ptr)3870 __lzo_ptr_linear(const lzo_voidp ptr)
3871 {
3872     lzo_uintptr_t p;
3873 
3874 #if (LZO_ARCH_I086)
3875 #error "LZO_ARCH_I086 is unsupported"
3876 #elif (LZO_MM_PVP)
3877 #error "LZO_MM_PVP is unsupported"
3878 #else
3879     p = (lzo_uintptr_t) PTR_LINEAR(ptr);
3880 #endif
3881 
3882     return p;
3883 }
3884 
3885 LZO_PUBLIC(unsigned)
__lzo_align_gap(const lzo_voidp ptr,lzo_uint size)3886 __lzo_align_gap(const lzo_voidp ptr, lzo_uint size)
3887 {
3888 #if (__LZO_UINTPTR_T_IS_POINTER)
3889 #error "__LZO_UINTPTR_T_IS_POINTER is unsupported"
3890 #else
3891     lzo_uintptr_t p, n;
3892     p = __lzo_ptr_linear(ptr);
3893     n = (((p + size - 1) / size) * size) - p;
3894 #endif
3895 
3896     assert(size > 0);
3897     assert((long)n >= 0);
3898     assert(n <= size);
3899     return (unsigned)n;
3900 }
3901 
3902 #endif
3903 #if !defined(MINILZO_CFG_SKIP_LZO_UTIL)
3904 
3905 /* If you use the LZO library in a product, I would appreciate that you
3906  * keep this copyright string in the executable of your product.
3907  */
3908 
3909 static const char __lzo_copyright[] =
3910 #if !defined(__LZO_IN_MINLZO)
3911     LZO_VERSION_STRING;
3912 #else
3913     "\r\n\n"
3914     "LZO data compression library.\n"
3915     "$Copyright: LZO Copyright (C) 1996-2014 Markus Franz Xaver Johannes Oberhumer\n"
3916     "<markus@oberhumer.com>\n"
3917     "http://www.oberhumer.com $\n\n"
3918     "$Id: LZO version: v" LZO_VERSION_STRING ", " LZO_VERSION_DATE " $\n"
3919     "$Info: " LZO_INFO_STRING " $\n";
3920 #endif
3921 
3922 LZO_PUBLIC(const lzo_bytep)
lzo_copyright(void)3923 lzo_copyright(void)
3924 {
3925     return (const lzo_bytep) __lzo_copyright;
3926 }
3927 
3928 LZO_PUBLIC(unsigned)
lzo_version(void)3929 lzo_version(void)
3930 {
3931     return LZO_VERSION;
3932 }
3933 
3934 LZO_PUBLIC(const char *)
lzo_version_string(void)3935 lzo_version_string(void)
3936 {
3937     return LZO_VERSION_STRING;
3938 }
3939 
3940 LZO_PUBLIC(const char *)
lzo_version_date(void)3941 lzo_version_date(void)
3942 {
3943     return LZO_VERSION_DATE;
3944 }
3945 
3946 LZO_PUBLIC(const lzo_charp)
_lzo_version_string(void)3947 _lzo_version_string(void)
3948 {
3949     return LZO_VERSION_STRING;
3950 }
3951 
3952 LZO_PUBLIC(const lzo_charp)
_lzo_version_date(void)3953 _lzo_version_date(void)
3954 {
3955     return LZO_VERSION_DATE;
3956 }
3957 
3958 #define LZO_BASE 65521u
3959 #define LZO_NMAX 5552
3960 
3961 #define LZO_DO1(buf,i)  s1 += buf[i]; s2 += s1
3962 #define LZO_DO2(buf,i)  LZO_DO1(buf,i); LZO_DO1(buf,i+1);
3963 #define LZO_DO4(buf,i)  LZO_DO2(buf,i); LZO_DO2(buf,i+2);
3964 #define LZO_DO8(buf,i)  LZO_DO4(buf,i); LZO_DO4(buf,i+4);
3965 #define LZO_DO16(buf,i) LZO_DO8(buf,i); LZO_DO8(buf,i+8);
3966 
3967 LZO_PUBLIC(lzo_uint32_t)
lzo_adler32(lzo_uint32_t adler,const lzo_bytep buf,lzo_uint len)3968 lzo_adler32(lzo_uint32_t adler, const lzo_bytep buf, lzo_uint len)
3969 {
3970     lzo_uint32_t s1 = adler & 0xffff;
3971     lzo_uint32_t s2 = (adler >> 16) & 0xffff;
3972     unsigned k;
3973 
3974     if (buf == NULL)
3975         return 1;
3976 
3977     while (len > 0)
3978     {
3979         k = len < LZO_NMAX ? (unsigned) len : LZO_NMAX;
3980         len -= k;
3981         if (k >= 16) do
3982         {
3983             LZO_DO16(buf,0);
3984             buf += 16;
3985             k -= 16;
3986         } while (k >= 16);
3987         if (k != 0) do
3988         {
3989             s1 += *buf++;
3990             s2 += s1;
3991         } while (--k > 0);
3992         s1 %= LZO_BASE;
3993         s2 %= LZO_BASE;
3994     }
3995     return (s2 << 16) | s1;
3996 }
3997 
3998 #undef LZO_DO1
3999 #undef LZO_DO2
4000 #undef LZO_DO4
4001 #undef LZO_DO8
4002 #undef LZO_DO16
4003 
4004 #endif
4005 #if !defined(MINILZO_CFG_SKIP_LZO_STRING)
4006 #undef lzo_memcmp
4007 #undef lzo_memcpy
4008 #undef lzo_memmove
4009 #undef lzo_memset
4010 #if !defined(__LZO_MMODEL_HUGE)
4011 #  undef LZO_HAVE_MM_HUGE_PTR
4012 #endif
4013 #define lzo_hsize_t             lzo_uint
4014 #define lzo_hvoid_p             lzo_voidp
4015 #define lzo_hbyte_p             lzo_bytep
4016 #define LZOLIB_PUBLIC(r,f)      LZO_PUBLIC(r) f
4017 #define lzo_hmemcmp             lzo_memcmp
4018 #define lzo_hmemcpy             lzo_memcpy
4019 #define lzo_hmemmove            lzo_memmove
4020 #define lzo_hmemset             lzo_memset
4021 #define __LZOLIB_HMEMCPY_CH_INCLUDED 1
4022 #if !defined(LZOLIB_PUBLIC)
4023 #  define LZOLIB_PUBLIC(r,f)    r __LZOLIB_FUNCNAME(f)
4024 #endif
LZOLIB_PUBLIC(int,lzo_hmemcmp)4025 LZOLIB_PUBLIC(int, lzo_hmemcmp) (const lzo_hvoid_p s1, const lzo_hvoid_p s2, lzo_hsize_t len)
4026 {
4027 #if (LZO_HAVE_MM_HUGE_PTR) || !(HAVE_MEMCMP)
4028     const lzo_hbyte_p p1 = LZO_STATIC_CAST(const lzo_hbyte_p, s1);
4029     const lzo_hbyte_p p2 = LZO_STATIC_CAST(const lzo_hbyte_p, s2);
4030     if __lzo_likely(len > 0) do
4031     {
4032         int d = *p1 - *p2;
4033         if (d != 0)
4034             return d;
4035         p1++; p2++;
4036     } while __lzo_likely(--len > 0);
4037     return 0;
4038 #else
4039     return memcmp(s1, s2, len);
4040 #endif
4041 }
LZOLIB_PUBLIC(lzo_hvoid_p,lzo_hmemcpy)4042 LZOLIB_PUBLIC(lzo_hvoid_p, lzo_hmemcpy) (lzo_hvoid_p dest, const lzo_hvoid_p src, lzo_hsize_t len)
4043 {
4044 #if (LZO_HAVE_MM_HUGE_PTR) || !(HAVE_MEMCPY)
4045     lzo_hbyte_p p1 = LZO_STATIC_CAST(lzo_hbyte_p, dest);
4046     const lzo_hbyte_p p2 = LZO_STATIC_CAST(const lzo_hbyte_p, src);
4047     if (!(len > 0) || p1 == p2)
4048         return dest;
4049     do
4050         *p1++ = *p2++;
4051     while __lzo_likely(--len > 0);
4052     return dest;
4053 #else
4054     return memcpy(dest, src, len);
4055 #endif
4056 }
LZOLIB_PUBLIC(lzo_hvoid_p,lzo_hmemmove)4057 LZOLIB_PUBLIC(lzo_hvoid_p, lzo_hmemmove) (lzo_hvoid_p dest, const lzo_hvoid_p src, lzo_hsize_t len)
4058 {
4059 #if (LZO_HAVE_MM_HUGE_PTR) || !(HAVE_MEMMOVE)
4060     lzo_hbyte_p p1 = LZO_STATIC_CAST(lzo_hbyte_p, dest);
4061     const lzo_hbyte_p p2 = LZO_STATIC_CAST(const lzo_hbyte_p, src);
4062     if (!(len > 0) || p1 == p2)
4063         return dest;
4064     if (p1 < p2)
4065     {
4066         do
4067             *p1++ = *p2++;
4068         while __lzo_likely(--len > 0);
4069     }
4070     else
4071     {
4072         p1 += len;
4073         p2 += len;
4074         do
4075             *--p1 = *--p2;
4076         while __lzo_likely(--len > 0);
4077     }
4078     return dest;
4079 #else
4080     return memmove(dest, src, len);
4081 #endif
4082 }
LZOLIB_PUBLIC(lzo_hvoid_p,lzo_hmemset)4083 LZOLIB_PUBLIC(lzo_hvoid_p, lzo_hmemset) (lzo_hvoid_p s, int cc, lzo_hsize_t len)
4084 {
4085 #if (LZO_HAVE_MM_HUGE_PTR) || !(HAVE_MEMSET)
4086     lzo_hbyte_p p = LZO_STATIC_CAST(lzo_hbyte_p, s);
4087     unsigned char c = LZO_ITRUNC(unsigned char, cc);
4088     if __lzo_likely(len > 0) do
4089         *p++ = c;
4090     while __lzo_likely(--len > 0);
4091     return s;
4092 #else
4093     return memset(s, cc, len);
4094 #endif
4095 }
4096 #undef LZOLIB_PUBLIC
4097 #endif
4098 #if !defined(MINILZO_CFG_SKIP_LZO_INIT)
4099 
4100 #if !defined(__LZO_IN_MINILZO)
4101 
4102 #define LZO_WANT_ACC_CHK_CH 1
4103 #undef LZOCHK_ASSERT
4104 
4105     LZOCHK_ASSERT((LZO_UINT32_C(1) << (int)(8*sizeof(LZO_UINT32_C(1))-1)) > 0)
4106     LZOCHK_ASSERT_IS_SIGNED_T(lzo_int)
4107     LZOCHK_ASSERT_IS_UNSIGNED_T(lzo_uint)
4108 #if !(__LZO_UINTPTR_T_IS_POINTER)
4109     LZOCHK_ASSERT_IS_UNSIGNED_T(lzo_uintptr_t)
4110 #endif
4111     LZOCHK_ASSERT(sizeof(lzo_uintptr_t) >= sizeof(lzo_voidp))
4112     LZOCHK_ASSERT_IS_UNSIGNED_T(lzo_xint)
4113 
4114 #endif
4115 #undef LZOCHK_ASSERT
4116 
4117 union lzo_config_check_union {
4118     lzo_uint a[2];
4119     unsigned char b[2*LZO_MAX(8,sizeof(lzo_uint))];
4120 #if defined(lzo_uint64_t)
4121     lzo_uint64_t c[2];
4122 #endif
4123 };
4124 
4125 #if 0
4126 #define u2p(ptr,off) ((lzo_voidp) (((lzo_bytep)(lzo_voidp)(ptr)) + (off)))
4127 #else
u2p(lzo_voidp ptr,lzo_uint off)4128 static __lzo_noinline lzo_voidp u2p(lzo_voidp ptr, lzo_uint off)
4129 {
4130     return (lzo_voidp) ((lzo_bytep) ptr + off);
4131 }
4132 #endif
4133 
4134 LZO_PUBLIC(int)
_lzo_config_check(void)4135 _lzo_config_check(void)
4136 {
4137 #if (LZO_CC_CLANG && (LZO_CC_CLANG >= 0x030100ul && LZO_CC_CLANG < 0x030300ul))
4138 # if 0
4139     volatile
4140 # endif
4141 #endif
4142     union lzo_config_check_union u;
4143     lzo_voidp p;
4144     unsigned r = 1;
4145 
4146     u.a[0] = u.a[1] = 0;
4147     p = u2p(&u, 0);
4148     r &= ((* (lzo_bytep) p) == 0);
4149 #if !(LZO_CFG_NO_CONFIG_CHECK)
4150 #if (LZO_ABI_BIG_ENDIAN)
4151     u.a[0] = u.a[1] = 0; u.b[sizeof(lzo_uint) - 1] = 128;
4152     p = u2p(&u, 0);
4153     r &= ((* (lzo_uintp) p) == 128);
4154 #endif
4155 #if (LZO_ABI_LITTLE_ENDIAN)
4156     u.a[0] = u.a[1] = 0; u.b[0] = 128;
4157     p = u2p(&u, 0);
4158     r &= ((* (lzo_uintp) p) == 128);
4159 #endif
4160     u.a[0] = u.a[1] = 0;
4161     u.b[0] = 1; u.b[3] = 2;
4162     p = u2p(&u, 1);
4163     r &= UA_GET_NE16(p) == 0;
4164     r &= UA_GET_LE16(p) == 0;
4165     u.b[1] = 128;
4166     r &= UA_GET_LE16(p) == 128;
4167     u.a[0] = u.a[1] = 0;
4168     u.b[0] = 3; u.b[5] = 4;
4169     p = u2p(&u, 1);
4170     r &= UA_GET_NE32(p) == 0;
4171     r &= UA_GET_LE32(p) == 0;
4172     u.b[1] = 128;
4173     r &= UA_GET_LE32(p) == 128;
4174 #if defined(UA_GET_NE64)
4175     u.c[0] = u.c[1] = 0;
4176     u.b[0] = 5; u.b[9] = 6;
4177     p = u2p(&u, 1);
4178     u.c[0] = u.c[1] = 0;
4179     r &= UA_GET_NE64(p) == 0;
4180 #if defined(UA_GET_LE64)
4181     r &= UA_GET_LE64(p) == 0;
4182     u.b[1] = 128;
4183     r &= UA_GET_LE64(p) == 128;
4184 #endif
4185 #endif
4186 #if defined(lzo_bitops_ctlz32)
4187     { unsigned i = 0; lzo_uint32_t v;
4188     for (v = 1; v != 0 && r == 1; v <<= 1, i++) {
4189         r &= lzo_bitops_ctlz32(v) == 31 - i;
4190         r &= lzo_bitops_ctlz32_func(v) == 31 - i;
4191     }}
4192 #endif
4193 #if defined(lzo_bitops_ctlz64)
4194     { unsigned i = 0; lzo_uint64_t v;
4195     for (v = 1; v != 0 && r == 1; v <<= 1, i++) {
4196         r &= lzo_bitops_ctlz64(v) == 63 - i;
4197         r &= lzo_bitops_ctlz64_func(v) == 63 - i;
4198     }}
4199 #endif
4200 #if defined(lzo_bitops_cttz32)
4201     { unsigned i = 0; lzo_uint32_t v;
4202     for (v = 1; v != 0 && r == 1; v <<= 1, i++) {
4203         r &= lzo_bitops_cttz32(v) == i;
4204         r &= lzo_bitops_cttz32_func(v) == i;
4205     }}
4206 #endif
4207 #if defined(lzo_bitops_cttz64)
4208     { unsigned i = 0; lzo_uint64_t v;
4209     for (v = 1; v != 0 && r == 1; v <<= 1, i++) {
4210         r &= lzo_bitops_cttz64(v) == i;
4211         r &= lzo_bitops_cttz64_func(v) == i;
4212     }}
4213 #endif
4214 #endif
4215     LZO_UNUSED_FUNC(lzo_bitops_unused_funcs);
4216 
4217     return r == 1 ? LZO_E_OK : LZO_E_ERROR;
4218 }
4219 
4220 LZO_PUBLIC(int)
__lzo_init_v2(unsigned v,int s1,int s2,int s3,int s4,int s5,int s6,int s7,int s8,int s9)4221 __lzo_init_v2(unsigned v, int s1, int s2, int s3, int s4, int s5,
4222                           int s6, int s7, int s8, int s9)
4223 {
4224     int r;
4225 
4226 #if defined(__LZO_IN_MINILZO)
4227 #elif (LZO_CC_MSC && ((_MSC_VER) < 700))
4228 #else
4229 #define LZO_WANT_ACC_CHK_CH 1
4230 #undef LZOCHK_ASSERT
4231 #define LZOCHK_ASSERT(expr)  LZO_COMPILE_TIME_ASSERT(expr)
4232 #endif
4233 #undef LZOCHK_ASSERT
4234 
4235     if (v == 0)
4236         return LZO_E_ERROR;
4237 
4238     r = (s1 == -1 || s1 == (int) sizeof(short)) &&
4239         (s2 == -1 || s2 == (int) sizeof(int)) &&
4240         (s3 == -1 || s3 == (int) sizeof(long)) &&
4241         (s4 == -1 || s4 == (int) sizeof(lzo_uint32_t)) &&
4242         (s5 == -1 || s5 == (int) sizeof(lzo_uint)) &&
4243         (s6 == -1 || s6 == (int) lzo_sizeof_dict_t) &&
4244         (s7 == -1 || s7 == (int) sizeof(char *)) &&
4245         (s8 == -1 || s8 == (int) sizeof(lzo_voidp)) &&
4246         (s9 == -1 || s9 == (int) sizeof(lzo_callback_t));
4247     if (!r)
4248         return LZO_E_ERROR;
4249 
4250     r = _lzo_config_check();
4251     if (r != LZO_E_OK)
4252         return r;
4253 
4254     return r;
4255 }
4256 
4257 #if !defined(__LZO_IN_MINILZO)
4258 
4259 #if (LZO_OS_WIN16 && LZO_CC_WATCOMC) && defined(__SW_BD)
4260 
4261 #if 0
4262 BOOL FAR PASCAL LibMain ( HANDLE hInstance, WORD wDataSegment,
4263                           WORD wHeapSize, LPSTR lpszCmdLine )
4264 #else
LibMain(int a,short b,short c,long d)4265 int __far __pascal LibMain ( int a, short b, short c, long d )
4266 #endif
4267 {
4268     LZO_UNUSED(a); LZO_UNUSED(b); LZO_UNUSED(c); LZO_UNUSED(d);
4269     return 1;
4270 }
4271 
4272 #endif
4273 
4274 #endif
4275 
4276 #endif
4277 
4278 #define LZO1X           1
4279 #define LZO_EOF_CODE    1
4280 #define M2_MAX_OFFSET   0x0800
4281 
4282 #if !defined(MINILZO_CFG_SKIP_LZO1X_1_COMPRESS)
4283 
4284 #if 1 && defined(UA_GET_LE32)
4285 #undef  LZO_DICT_USE_PTR
4286 #define LZO_DICT_USE_PTR 0
4287 #undef  lzo_dict_t
4288 #define lzo_dict_t lzo_uint16_t
4289 #endif
4290 
4291 #define LZO_NEED_DICT_H 1
4292 #ifndef D_BITS
4293 #define D_BITS          14
4294 #endif
4295 #define D_INDEX1(d,p)       d = DM(DMUL(0x21,DX3(p,5,5,6)) >> 5)
4296 #define D_INDEX2(d,p)       d = (d & (D_MASK & 0x7ff)) ^ (D_HIGH | 0x1f)
4297 #if 1
4298 #define DINDEX(dv,p)        DM(((DMUL(0x1824429d,dv)) >> (32-D_BITS)))
4299 #else
4300 #define DINDEX(dv,p)        DM((dv) + ((dv) >> (32-D_BITS)))
4301 #endif
4302 
4303 #ifndef __LZO_CONFIG1X_H
4304 #define __LZO_CONFIG1X_H 1
4305 
4306 #if !defined(LZO1X) && !defined(LZO1Y) && !defined(LZO1Z)
4307 #  define LZO1X 1
4308 #endif
4309 
4310 #if !defined(__LZO_IN_MINILZO)
4311 #include "lzo/lzo1x.h"
4312 #endif
4313 
4314 #ifndef LZO_EOF_CODE
4315 #define LZO_EOF_CODE 1
4316 #endif
4317 #undef LZO_DETERMINISTIC
4318 
4319 #define M1_MAX_OFFSET   0x0400
4320 #ifndef M2_MAX_OFFSET
4321 #define M2_MAX_OFFSET   0x0800
4322 #endif
4323 #define M3_MAX_OFFSET   0x4000
4324 #define M4_MAX_OFFSET   0xbfff
4325 
4326 #define MX_MAX_OFFSET   (M1_MAX_OFFSET + M2_MAX_OFFSET)
4327 
4328 #define M1_MIN_LEN      2
4329 #define M1_MAX_LEN      2
4330 #define M2_MIN_LEN      3
4331 #ifndef M2_MAX_LEN
4332 #define M2_MAX_LEN      8
4333 #endif
4334 #define M3_MIN_LEN      3
4335 #define M3_MAX_LEN      33
4336 #define M4_MIN_LEN      3
4337 #define M4_MAX_LEN      9
4338 
4339 #define M1_MARKER       0
4340 #define M2_MARKER       64
4341 #define M3_MARKER       32
4342 #define M4_MARKER       16
4343 
4344 #ifndef MIN_LOOKAHEAD
4345 #define MIN_LOOKAHEAD       (M2_MAX_LEN + 1)
4346 #endif
4347 
4348 #if defined(LZO_NEED_DICT_H)
4349 
4350 #ifndef LZO_HASH
4351 #define LZO_HASH            LZO_HASH_LZO_INCREMENTAL_B
4352 #endif
4353 #define DL_MIN_LEN          M2_MIN_LEN
4354 
4355 #ifndef __LZO_DICT_H
4356 #define __LZO_DICT_H 1
4357 
4358 #ifdef __cplusplus
4359 extern "C" {
4360 #endif
4361 
4362 #if !defined(D_BITS) && defined(DBITS)
4363 #  define D_BITS        DBITS
4364 #endif
4365 #if !defined(D_BITS)
4366 #  error "D_BITS is not defined"
4367 #endif
4368 #if (D_BITS < 16)
4369 #  define D_SIZE        LZO_SIZE(D_BITS)
4370 #  define D_MASK        LZO_MASK(D_BITS)
4371 #else
4372 #  define D_SIZE        LZO_USIZE(D_BITS)
4373 #  define D_MASK        LZO_UMASK(D_BITS)
4374 #endif
4375 #define D_HIGH          ((D_MASK >> 1) + 1)
4376 
4377 #if !defined(DD_BITS)
4378 #  define DD_BITS       0
4379 #endif
4380 #define DD_SIZE         LZO_SIZE(DD_BITS)
4381 #define DD_MASK         LZO_MASK(DD_BITS)
4382 
4383 #if !defined(DL_BITS)
4384 #  define DL_BITS       (D_BITS - DD_BITS)
4385 #endif
4386 #if (DL_BITS < 16)
4387 #  define DL_SIZE       LZO_SIZE(DL_BITS)
4388 #  define DL_MASK       LZO_MASK(DL_BITS)
4389 #else
4390 #  define DL_SIZE       LZO_USIZE(DL_BITS)
4391 #  define DL_MASK       LZO_UMASK(DL_BITS)
4392 #endif
4393 
4394 #if (D_BITS != DL_BITS + DD_BITS)
4395 #  error "D_BITS does not match"
4396 #endif
4397 #if (D_BITS < 6 || D_BITS > 18)
4398 #  error "invalid D_BITS"
4399 #endif
4400 #if (DL_BITS < 6 || DL_BITS > 20)
4401 #  error "invalid DL_BITS"
4402 #endif
4403 #if (DD_BITS < 0 || DD_BITS > 6)
4404 #  error "invalid DD_BITS"
4405 #endif
4406 
4407 #if !defined(DL_MIN_LEN)
4408 #  define DL_MIN_LEN    3
4409 #endif
4410 #if !defined(DL_SHIFT)
4411 #  define DL_SHIFT      ((DL_BITS + (DL_MIN_LEN - 1)) / DL_MIN_LEN)
4412 #endif
4413 
4414 #define LZO_HASH_GZIP                   1
4415 #define LZO_HASH_GZIP_INCREMENTAL       2
4416 #define LZO_HASH_LZO_INCREMENTAL_A      3
4417 #define LZO_HASH_LZO_INCREMENTAL_B      4
4418 
4419 #if !defined(LZO_HASH)
4420 #  error "choose a hashing strategy"
4421 #endif
4422 
4423 #undef DM
4424 #undef DX
4425 
4426 #if (DL_MIN_LEN == 3)
4427 #  define _DV2_A(p,shift1,shift2) \
4428         (((( (lzo_xint)((p)[0]) << shift1) ^ (p)[1]) << shift2) ^ (p)[2])
4429 #  define _DV2_B(p,shift1,shift2) \
4430         (((( (lzo_xint)((p)[2]) << shift1) ^ (p)[1]) << shift2) ^ (p)[0])
4431 #  define _DV3_B(p,shift1,shift2,shift3) \
4432         ((_DV2_B((p)+1,shift1,shift2) << (shift3)) ^ (p)[0])
4433 #elif (DL_MIN_LEN == 2)
4434 #  define _DV2_A(p,shift1,shift2) \
4435         (( (lzo_xint)(p[0]) << shift1) ^ p[1])
4436 #  define _DV2_B(p,shift1,shift2) \
4437         (( (lzo_xint)(p[1]) << shift1) ^ p[2])
4438 #else
4439 #  error "invalid DL_MIN_LEN"
4440 #endif
4441 #define _DV_A(p,shift)      _DV2_A(p,shift,shift)
4442 #define _DV_B(p,shift)      _DV2_B(p,shift,shift)
4443 #define DA2(p,s1,s2) \
4444         (((((lzo_xint)((p)[2]) << (s2)) + (p)[1]) << (s1)) + (p)[0])
4445 #define DS2(p,s1,s2) \
4446         (((((lzo_xint)((p)[2]) << (s2)) - (p)[1]) << (s1)) - (p)[0])
4447 #define DX2(p,s1,s2) \
4448         (((((lzo_xint)((p)[2]) << (s2)) ^ (p)[1]) << (s1)) ^ (p)[0])
4449 #define DA3(p,s1,s2,s3) ((DA2((p)+1,s2,s3) << (s1)) + (p)[0])
4450 #define DS3(p,s1,s2,s3) ((DS2((p)+1,s2,s3) << (s1)) - (p)[0])
4451 #define DX3(p,s1,s2,s3) ((DX2((p)+1,s2,s3) << (s1)) ^ (p)[0])
4452 #define DMS(v,s)        ((lzo_uint) (((v) & (D_MASK >> (s))) << (s)))
4453 #define DM(v)           DMS(v,0)
4454 
4455 #if (LZO_HASH == LZO_HASH_GZIP)
4456 #  define _DINDEX(dv,p)     (_DV_A((p),DL_SHIFT))
4457 
4458 #elif (LZO_HASH == LZO_HASH_GZIP_INCREMENTAL)
4459 #  define __LZO_HASH_INCREMENTAL 1
4460 #  define DVAL_FIRST(dv,p)  dv = _DV_A((p),DL_SHIFT)
4461 #  define DVAL_NEXT(dv,p)   dv = (((dv) << DL_SHIFT) ^ p[2])
4462 #  define _DINDEX(dv,p)     (dv)
4463 #  define DVAL_LOOKAHEAD    DL_MIN_LEN
4464 
4465 #elif (LZO_HASH == LZO_HASH_LZO_INCREMENTAL_A)
4466 #  define __LZO_HASH_INCREMENTAL 1
4467 #  define DVAL_FIRST(dv,p)  dv = _DV_A((p),5)
4468 #  define DVAL_NEXT(dv,p) \
4469                 dv ^= (lzo_xint)(p[-1]) << (2*5); dv = (((dv) << 5) ^ p[2])
4470 #  define _DINDEX(dv,p)     ((DMUL(0x9f5f,dv)) >> 5)
4471 #  define DVAL_LOOKAHEAD    DL_MIN_LEN
4472 
4473 #elif (LZO_HASH == LZO_HASH_LZO_INCREMENTAL_B)
4474 #  define __LZO_HASH_INCREMENTAL 1
4475 #  define DVAL_FIRST(dv,p)  dv = _DV_B((p),5)
4476 #  define DVAL_NEXT(dv,p) \
4477                 dv ^= p[-1]; dv = (((dv) >> 5) ^ ((lzo_xint)(p[2]) << (2*5)))
4478 #  define _DINDEX(dv,p)     ((DMUL(0x9f5f,dv)) >> 5)
4479 #  define DVAL_LOOKAHEAD    DL_MIN_LEN
4480 
4481 #else
4482 #  error "choose a hashing strategy"
4483 #endif
4484 
4485 #ifndef DINDEX
4486 #define DINDEX(dv,p)        ((lzo_uint)((_DINDEX(dv,p)) & DL_MASK) << DD_BITS)
4487 #endif
4488 #if !defined(DINDEX1) && defined(D_INDEX1)
4489 #define DINDEX1             D_INDEX1
4490 #endif
4491 #if !defined(DINDEX2) && defined(D_INDEX2)
4492 #define DINDEX2             D_INDEX2
4493 #endif
4494 
4495 #if !defined(__LZO_HASH_INCREMENTAL)
4496 #  define DVAL_FIRST(dv,p)  ((void) 0)
4497 #  define DVAL_NEXT(dv,p)   ((void) 0)
4498 #  define DVAL_LOOKAHEAD    0
4499 #endif
4500 
4501 #if !defined(DVAL_ASSERT)
4502 #if defined(__LZO_HASH_INCREMENTAL) && !defined(NDEBUG)
4503 #if (LZO_CC_CLANG || (LZO_CC_GNUC >= 0x020700ul) || LZO_CC_LLVM)
4504 static void __attribute__((__unused__))
4505 #else
4506 static void
4507 #endif
DVAL_ASSERT(lzo_xint dv,const lzo_bytep p)4508 DVAL_ASSERT(lzo_xint dv, const lzo_bytep p)
4509 {
4510     lzo_xint df;
4511     DVAL_FIRST(df,(p));
4512     assert(DINDEX(dv,p) == DINDEX(df,p));
4513 }
4514 #else
4515 #  define DVAL_ASSERT(dv,p) ((void) 0)
4516 #endif
4517 #endif
4518 
4519 #if (LZO_DICT_USE_PTR)
4520 #  define DENTRY(p,in)                          (p)
4521 #  define GINDEX(m_pos,m_off,dict,dindex,in)    m_pos = dict[dindex]
4522 #else
4523 #  define DENTRY(p,in)                          ((lzo_dict_t) pd(p, in))
4524 #  define GINDEX(m_pos,m_off,dict,dindex,in)    m_off = dict[dindex]
4525 #endif
4526 
4527 #if (DD_BITS == 0)
4528 
4529 #  define UPDATE_D(dict,drun,dv,p,in)       dict[ DINDEX(dv,p) ] = DENTRY(p,in)
4530 #  define UPDATE_I(dict,drun,index,p,in)    dict[index] = DENTRY(p,in)
4531 #  define UPDATE_P(ptr,drun,p,in)           (ptr)[0] = DENTRY(p,in)
4532 
4533 #else
4534 
4535 #  define UPDATE_D(dict,drun,dv,p,in)   \
4536         dict[ DINDEX(dv,p) + drun++ ] = DENTRY(p,in); drun &= DD_MASK
4537 #  define UPDATE_I(dict,drun,index,p,in)    \
4538         dict[ (index) + drun++ ] = DENTRY(p,in); drun &= DD_MASK
4539 #  define UPDATE_P(ptr,drun,p,in)   \
4540         (ptr) [ drun++ ] = DENTRY(p,in); drun &= DD_MASK
4541 
4542 #endif
4543 
4544 #if (LZO_DICT_USE_PTR)
4545 
4546 #define LZO_CHECK_MPOS_DET(m_pos,m_off,in,ip,max_offset) \
4547         (m_pos == NULL || (m_off = pd(ip, m_pos)) > max_offset)
4548 
4549 #define LZO_CHECK_MPOS_NON_DET(m_pos,m_off,in,ip,max_offset) \
4550     (BOUNDS_CHECKING_OFF_IN_EXPR(( \
4551         m_pos = ip - (lzo_uint) PTR_DIFF(ip,m_pos), \
4552         PTR_LT(m_pos,in) || \
4553         (m_off = (lzo_uint) PTR_DIFF(ip,m_pos)) == 0 || \
4554          m_off > max_offset )))
4555 
4556 #else
4557 
4558 #define LZO_CHECK_MPOS_DET(m_pos,m_off,in,ip,max_offset) \
4559         (m_off == 0 || \
4560          ((m_off = pd(ip, in) - m_off) > max_offset) || \
4561          (m_pos = (ip) - (m_off), 0) )
4562 
4563 #define LZO_CHECK_MPOS_NON_DET(m_pos,m_off,in,ip,max_offset) \
4564         (pd(ip, in) <= m_off || \
4565          ((m_off = pd(ip, in) - m_off) > max_offset) || \
4566          (m_pos = (ip) - (m_off), 0) )
4567 
4568 #endif
4569 
4570 #if (LZO_DETERMINISTIC)
4571 #  define LZO_CHECK_MPOS    LZO_CHECK_MPOS_DET
4572 #else
4573 #  define LZO_CHECK_MPOS    LZO_CHECK_MPOS_NON_DET
4574 #endif
4575 
4576 #ifdef __cplusplus
4577 }
4578 #endif
4579 
4580 #endif
4581 
4582 #endif
4583 
4584 #endif
4585 
4586 #define LZO_DETERMINISTIC !(LZO_DICT_USE_PTR)
4587 
4588 #ifndef DO_COMPRESS
4589 #define DO_COMPRESS     lzo1x_1_compress
4590 #endif
4591 
4592 #if 1 && defined(DO_COMPRESS) && !defined(do_compress)
4593 #  define do_compress       LZO_PP_ECONCAT2(DO_COMPRESS,_core)
4594 #endif
4595 
4596 static __lzo_noinline lzo_uint
do_compress(const lzo_bytep in,lzo_uint in_len,lzo_bytep out,lzo_uintp out_len,lzo_uint ti,lzo_voidp wrkmem)4597 do_compress ( const lzo_bytep in , lzo_uint  in_len,
4598                     lzo_bytep out, lzo_uintp out_len,
4599                     lzo_uint  ti,  lzo_voidp wrkmem)
4600 {
4601     const lzo_bytep ip;
4602     lzo_bytep op;
4603     const lzo_bytep const in_end = in + in_len;
4604     const lzo_bytep const ip_end = in + in_len - 20;
4605     const lzo_bytep ii;
4606     lzo_dict_p const dict = (lzo_dict_p) wrkmem;
4607 
4608     op = out;
4609     ip = in;
4610     ii = ip;
4611 
4612     ip += ti < 4 ? 4 - ti : 0;
4613     for (;;)
4614     {
4615         const lzo_bytep m_pos;
4616 #if !(LZO_DETERMINISTIC)
4617         LZO_DEFINE_UNINITIALIZED_VAR(lzo_uint, m_off, 0);
4618         lzo_uint m_len;
4619         lzo_uint dindex;
4620 next:
4621         if __lzo_unlikely(ip >= ip_end)
4622             break;
4623         DINDEX1(dindex,ip);
4624         GINDEX(m_pos,m_off,dict,dindex,in);
4625         if (LZO_CHECK_MPOS_NON_DET(m_pos,m_off,in,ip,M4_MAX_OFFSET))
4626             goto literal;
4627 #if 1
4628         if (m_off <= M2_MAX_OFFSET || m_pos[3] == ip[3])
4629             goto try_match;
4630         DINDEX2(dindex,ip);
4631 #endif
4632         GINDEX(m_pos,m_off,dict,dindex,in);
4633         if (LZO_CHECK_MPOS_NON_DET(m_pos,m_off,in,ip,M4_MAX_OFFSET))
4634             goto literal;
4635         if (m_off <= M2_MAX_OFFSET || m_pos[3] == ip[3])
4636             goto try_match;
4637         goto literal;
4638 
4639 try_match:
4640 #if (LZO_OPT_UNALIGNED32)
4641         if (UA_GET_NE32(m_pos) != UA_GET_NE32(ip))
4642 #else
4643         if (m_pos[0] != ip[0] || m_pos[1] != ip[1] || m_pos[2] != ip[2] || m_pos[3] != ip[3])
4644 #endif
4645         {
4646 literal:
4647             UPDATE_I(dict,0,dindex,ip,in);
4648             ip += 1 + ((ip - ii) >> 5);
4649             continue;
4650         }
4651         UPDATE_I(dict,0,dindex,ip,in);
4652 #else
4653         lzo_uint m_off;
4654         lzo_uint m_len;
4655         {
4656         lzo_uint32_t dv;
4657         lzo_uint dindex;
4658 literal:
4659         ip += 1 + ((ip - ii) >> 5);
4660 next:
4661         if __lzo_unlikely(ip >= ip_end)
4662             break;
4663         dv = UA_GET_LE32(ip);
4664         dindex = DINDEX(dv,ip);
4665         GINDEX(m_off,m_pos,in+dict,dindex,in);
4666         UPDATE_I(dict,0,dindex,ip,in);
4667         if __lzo_unlikely(dv != UA_GET_LE32(m_pos))
4668             goto literal;
4669         }
4670 #endif
4671 
4672         ii -= ti; ti = 0;
4673         {
4674         lzo_uint t = pd(ip,ii);
4675         if (t != 0)
4676         {
4677             if (t <= 3)
4678             {
4679                 op[-2] = LZO_BYTE(op[-2] | t);
4680 #if (LZO_OPT_UNALIGNED32)
4681                 UA_COPY4(op, ii);
4682                 op += t;
4683 #else
4684                 { do *op++ = *ii++; while (--t > 0); }
4685 #endif
4686             }
4687 #if (LZO_OPT_UNALIGNED32) || (LZO_OPT_UNALIGNED64)
4688             else if (t <= 16)
4689             {
4690                 *op++ = LZO_BYTE(t - 3);
4691                 UA_COPY8(op, ii);
4692                 UA_COPY8(op+8, ii+8);
4693                 op += t;
4694             }
4695 #endif
4696             else
4697             {
4698                 if (t <= 18)
4699                     *op++ = LZO_BYTE(t - 3);
4700                 else
4701                 {
4702                     lzo_uint tt = t - 18;
4703                     *op++ = 0;
4704                     while __lzo_unlikely(tt > 255)
4705                     {
4706                         tt -= 255;
4707                         UA_SET1(op, 0);
4708                         op++;
4709                     }
4710                     assert(tt > 0);
4711                     *op++ = LZO_BYTE(tt);
4712                 }
4713 #if (LZO_OPT_UNALIGNED32) || (LZO_OPT_UNALIGNED64)
4714                 do {
4715                     UA_COPY8(op, ii);
4716                     UA_COPY8(op+8, ii+8);
4717                     op += 16; ii += 16; t -= 16;
4718                 } while (t >= 16); if (t > 0)
4719 #endif
4720                 { do *op++ = *ii++; while (--t > 0); }
4721             }
4722         }
4723         }
4724         m_len = 4;
4725         {
4726 #if (LZO_OPT_UNALIGNED64)
4727         lzo_uint64_t v;
4728         v = UA_GET_NE64(ip + m_len) ^ UA_GET_NE64(m_pos + m_len);
4729         if __lzo_unlikely(v == 0) {
4730             do {
4731                 m_len += 8;
4732                 v = UA_GET_NE64(ip + m_len) ^ UA_GET_NE64(m_pos + m_len);
4733                 if __lzo_unlikely(ip + m_len >= ip_end)
4734                     goto m_len_done;
4735             } while (v == 0);
4736         }
4737 #if (LZO_ABI_BIG_ENDIAN) && defined(lzo_bitops_ctlz64)
4738         m_len += lzo_bitops_ctlz64(v) / CHAR_BIT;
4739 #elif (LZO_ABI_BIG_ENDIAN)
4740         if ((v >> (64 - CHAR_BIT)) == 0) do {
4741             v <<= CHAR_BIT;
4742             m_len += 1;
4743         } while ((v >> (64 - CHAR_BIT)) == 0);
4744 #elif (LZO_ABI_LITTLE_ENDIAN) && defined(lzo_bitops_cttz64)
4745         m_len += lzo_bitops_cttz64(v) / CHAR_BIT;
4746 #elif (LZO_ABI_LITTLE_ENDIAN)
4747         if ((v & UCHAR_MAX) == 0) do {
4748             v >>= CHAR_BIT;
4749             m_len += 1;
4750         } while ((v & UCHAR_MAX) == 0);
4751 #else
4752         if (ip[m_len] == m_pos[m_len]) do {
4753             m_len += 1;
4754         } while (ip[m_len] == m_pos[m_len]);
4755 #endif
4756 #elif (LZO_OPT_UNALIGNED32)
4757         lzo_uint32_t v;
4758         v = UA_GET_NE32(ip + m_len) ^ UA_GET_NE32(m_pos + m_len);
4759         if __lzo_unlikely(v == 0) {
4760             do {
4761                 m_len += 4;
4762                 v = UA_GET_NE32(ip + m_len) ^ UA_GET_NE32(m_pos + m_len);
4763                 if (v != 0)
4764                     break;
4765                 m_len += 4;
4766                 v = UA_GET_NE32(ip + m_len) ^ UA_GET_NE32(m_pos + m_len);
4767                 if __lzo_unlikely(ip + m_len >= ip_end)
4768                     goto m_len_done;
4769             } while (v == 0);
4770         }
4771 #if (LZO_ABI_BIG_ENDIAN) && defined(lzo_bitops_ctlz32)
4772         m_len += lzo_bitops_ctlz32(v) / CHAR_BIT;
4773 #elif (LZO_ABI_BIG_ENDIAN)
4774         if ((v >> (32 - CHAR_BIT)) == 0) do {
4775             v <<= CHAR_BIT;
4776             m_len += 1;
4777         } while ((v >> (32 - CHAR_BIT)) == 0);
4778 #elif (LZO_ABI_LITTLE_ENDIAN) && defined(lzo_bitops_cttz32)
4779         m_len += lzo_bitops_cttz32(v) / CHAR_BIT;
4780 #elif (LZO_ABI_LITTLE_ENDIAN)
4781         if ((v & UCHAR_MAX) == 0) do {
4782             v >>= CHAR_BIT;
4783             m_len += 1;
4784         } while ((v & UCHAR_MAX) == 0);
4785 #else
4786         if (ip[m_len] == m_pos[m_len]) do {
4787             m_len += 1;
4788         } while (ip[m_len] == m_pos[m_len]);
4789 #endif
4790 #else
4791         if __lzo_unlikely(ip[m_len] == m_pos[m_len]) {
4792             do {
4793                 m_len += 1;
4794                 if (ip[m_len] != m_pos[m_len])
4795                     break;
4796                 m_len += 1;
4797                 if (ip[m_len] != m_pos[m_len])
4798                     break;
4799                 m_len += 1;
4800                 if (ip[m_len] != m_pos[m_len])
4801                     break;
4802                 m_len += 1;
4803                 if (ip[m_len] != m_pos[m_len])
4804                     break;
4805                 m_len += 1;
4806                 if (ip[m_len] != m_pos[m_len])
4807                     break;
4808                 m_len += 1;
4809                 if (ip[m_len] != m_pos[m_len])
4810                     break;
4811                 m_len += 1;
4812                 if (ip[m_len] != m_pos[m_len])
4813                     break;
4814                 m_len += 1;
4815                 if __lzo_unlikely(ip + m_len >= ip_end)
4816                     goto m_len_done;
4817             } while (ip[m_len] == m_pos[m_len]);
4818         }
4819 #endif
4820         }
4821 m_len_done:
4822         m_off = pd(ip,m_pos);
4823         ip += m_len;
4824         ii = ip;
4825         if (m_len <= M2_MAX_LEN && m_off <= M2_MAX_OFFSET)
4826         {
4827             m_off -= 1;
4828 #if defined(LZO1X)
4829             *op++ = LZO_BYTE(((m_len - 1) << 5) | ((m_off & 7) << 2));
4830             *op++ = LZO_BYTE(m_off >> 3);
4831 #elif defined(LZO1Y)
4832             *op++ = LZO_BYTE(((m_len + 1) << 4) | ((m_off & 3) << 2));
4833             *op++ = LZO_BYTE(m_off >> 2);
4834 #endif
4835         }
4836         else if (m_off <= M3_MAX_OFFSET)
4837         {
4838             m_off -= 1;
4839             if (m_len <= M3_MAX_LEN)
4840                 *op++ = LZO_BYTE(M3_MARKER | (m_len - 2));
4841             else
4842             {
4843                 m_len -= M3_MAX_LEN;
4844                 *op++ = M3_MARKER | 0;
4845                 while __lzo_unlikely(m_len > 255)
4846                 {
4847                     m_len -= 255;
4848                     UA_SET1(op, 0);
4849                     op++;
4850                 }
4851                 *op++ = LZO_BYTE(m_len);
4852             }
4853             *op++ = LZO_BYTE(m_off << 2);
4854             *op++ = LZO_BYTE(m_off >> 6);
4855         }
4856         else
4857         {
4858             m_off -= 0x4000;
4859             if (m_len <= M4_MAX_LEN)
4860                 *op++ = LZO_BYTE(M4_MARKER | ((m_off >> 11) & 8) | (m_len - 2));
4861             else
4862             {
4863                 m_len -= M4_MAX_LEN;
4864                 *op++ = LZO_BYTE(M4_MARKER | ((m_off >> 11) & 8));
4865                 while __lzo_unlikely(m_len > 255)
4866                 {
4867                     m_len -= 255;
4868                     UA_SET1(op, 0);
4869                     op++;
4870                 }
4871                 *op++ = LZO_BYTE(m_len);
4872             }
4873             *op++ = LZO_BYTE(m_off << 2);
4874             *op++ = LZO_BYTE(m_off >> 6);
4875         }
4876         goto next;
4877     }
4878 
4879     *out_len = pd(op, out);
4880     return pd(in_end,ii-ti);
4881 }
4882 
4883 LZO_PUBLIC(int)
DO_COMPRESS(const lzo_bytep in,lzo_uint in_len,lzo_bytep out,lzo_uintp out_len,lzo_voidp wrkmem)4884 DO_COMPRESS      ( const lzo_bytep in , lzo_uint  in_len,
4885                          lzo_bytep out, lzo_uintp out_len,
4886                          lzo_voidp wrkmem )
4887 {
4888     const lzo_bytep ip = in;
4889     lzo_bytep op = out;
4890     lzo_uint l = in_len;
4891     lzo_uint t = 0;
4892 
4893     while (l > 20)
4894     {
4895         lzo_uint ll = l;
4896         lzo_uintptr_t ll_end;
4897 #if 0 || (LZO_DETERMINISTIC)
4898         ll = LZO_MIN(ll, 49152);
4899 #endif
4900         ll_end = (lzo_uintptr_t)ip + ll;
4901         if ((ll_end + ((t + ll) >> 5)) <= ll_end || (const lzo_bytep)(ll_end + ((t + ll) >> 5)) <= ip + ll)
4902             break;
4903 #if (LZO_DETERMINISTIC)
4904         lzo_memset(wrkmem, 0, ((lzo_uint)1 << D_BITS) * sizeof(lzo_dict_t));
4905 #endif
4906         t = do_compress(ip,ll,op,out_len,t,wrkmem);
4907         ip += ll;
4908         op += *out_len;
4909         l  -= ll;
4910     }
4911     t += l;
4912 
4913     if (t > 0)
4914     {
4915         const lzo_bytep ii = in + in_len - t;
4916 
4917         if (op == out && t <= 238)
4918             *op++ = LZO_BYTE(17 + t);
4919         else if (t <= 3)
4920             op[-2] = LZO_BYTE(op[-2] | t);
4921         else if (t <= 18)
4922             *op++ = LZO_BYTE(t - 3);
4923         else
4924         {
4925             lzo_uint tt = t - 18;
4926 
4927             *op++ = 0;
4928             while (tt > 255)
4929             {
4930                 tt -= 255;
4931                 UA_SET1(op, 0);
4932                 op++;
4933             }
4934             assert(tt > 0);
4935             *op++ = LZO_BYTE(tt);
4936         }
4937         UA_COPYN(op, ii, t);
4938         op += t;
4939     }
4940 
4941     *op++ = M4_MARKER | 1;
4942     *op++ = 0;
4943     *op++ = 0;
4944 
4945     *out_len = pd(op, out);
4946     return LZO_E_OK;
4947 }
4948 
4949 #endif
4950 
4951 #undef do_compress
4952 #undef DO_COMPRESS
4953 #undef LZO_HASH
4954 
4955 #undef LZO_TEST_OVERRUN
4956 #undef DO_DECOMPRESS
4957 #define DO_DECOMPRESS       lzo1x_decompress
4958 
4959 #if !defined(MINILZO_CFG_SKIP_LZO1X_DECOMPRESS)
4960 
4961 #if defined(LZO_TEST_OVERRUN)
4962 #  if !defined(LZO_TEST_OVERRUN_INPUT)
4963 #    define LZO_TEST_OVERRUN_INPUT       2
4964 #  endif
4965 #  if !defined(LZO_TEST_OVERRUN_OUTPUT)
4966 #    define LZO_TEST_OVERRUN_OUTPUT      2
4967 #  endif
4968 #  if !defined(LZO_TEST_OVERRUN_LOOKBEHIND)
4969 #    define LZO_TEST_OVERRUN_LOOKBEHIND  1
4970 #  endif
4971 #endif
4972 
4973 #undef TEST_IP
4974 #undef TEST_OP
4975 #undef TEST_IP_AND_TEST_OP
4976 #undef TEST_LB
4977 #undef TEST_LBO
4978 #undef NEED_IP
4979 #undef NEED_OP
4980 #undef TEST_IV
4981 #undef TEST_OV
4982 #undef HAVE_TEST_IP
4983 #undef HAVE_TEST_OP
4984 #undef HAVE_NEED_IP
4985 #undef HAVE_NEED_OP
4986 #undef HAVE_ANY_IP
4987 #undef HAVE_ANY_OP
4988 
4989 #if defined(LZO_TEST_OVERRUN_INPUT)
4990 #  if (LZO_TEST_OVERRUN_INPUT >= 1)
4991 #    define TEST_IP             (ip < ip_end)
4992 #  endif
4993 #  if (LZO_TEST_OVERRUN_INPUT >= 2)
4994 #    define NEED_IP(x) \
4995             if ((lzo_uint)(ip_end - ip) < (lzo_uint)(x))  goto input_overrun
4996 #    define TEST_IV(x)          if ((x) >  (lzo_uint)0 - (511)) goto input_overrun
4997 #  endif
4998 #endif
4999 
5000 #if defined(LZO_TEST_OVERRUN_OUTPUT)
5001 #  if (LZO_TEST_OVERRUN_OUTPUT >= 1)
5002 #    define TEST_OP             (op <= op_end)
5003 #  endif
5004 #  if (LZO_TEST_OVERRUN_OUTPUT >= 2)
5005 #    undef TEST_OP
5006 #    define NEED_OP(x) \
5007             if ((lzo_uint)(op_end - op) < (lzo_uint)(x))  goto output_overrun
5008 #    define TEST_OV(x)          if ((x) >  (lzo_uint)0 - (511)) goto output_overrun
5009 #  endif
5010 #endif
5011 
5012 #if defined(LZO_TEST_OVERRUN_LOOKBEHIND)
5013 #  define TEST_LB(m_pos)        if (PTR_LT(m_pos,out) || PTR_GE(m_pos,op)) goto lookbehind_overrun
5014 #  define TEST_LBO(m_pos,o)     if (PTR_LT(m_pos,out) || PTR_GE(m_pos,op-(o))) goto lookbehind_overrun
5015 #else
5016 #  define TEST_LB(m_pos)        ((void) 0)
5017 #  define TEST_LBO(m_pos,o)     ((void) 0)
5018 #endif
5019 
5020 #if !defined(LZO_EOF_CODE) && !defined(TEST_IP)
5021 #  define TEST_IP               (ip < ip_end)
5022 #endif
5023 
5024 #if defined(TEST_IP)
5025 #  define HAVE_TEST_IP 1
5026 #else
5027 #  define TEST_IP               1
5028 #endif
5029 #if defined(TEST_OP)
5030 #  define HAVE_TEST_OP 1
5031 #else
5032 #  define TEST_OP               1
5033 #endif
5034 
5035 #if defined(HAVE_TEST_IP) && defined(HAVE_TEST_OP)
5036 #  define TEST_IP_AND_TEST_OP   (TEST_IP && TEST_OP)
5037 #elif defined(HAVE_TEST_IP)
5038 #  define TEST_IP_AND_TEST_OP   TEST_IP
5039 #elif defined(HAVE_TEST_OP)
5040 #  define TEST_IP_AND_TEST_OP   TEST_OP
5041 #else
5042 #  define TEST_IP_AND_TEST_OP   1
5043 #endif
5044 
5045 #if defined(NEED_IP)
5046 #  define HAVE_NEED_IP 1
5047 #else
5048 #  define NEED_IP(x)            ((void) 0)
5049 #  define TEST_IV(x)            ((void) 0)
5050 #endif
5051 #if defined(NEED_OP)
5052 #  define HAVE_NEED_OP 1
5053 #else
5054 #  define NEED_OP(x)            ((void) 0)
5055 #  define TEST_OV(x)            ((void) 0)
5056 #endif
5057 
5058 #if defined(HAVE_TEST_IP) || defined(HAVE_NEED_IP)
5059 #  define HAVE_ANY_IP 1
5060 #endif
5061 #if defined(HAVE_TEST_OP) || defined(HAVE_NEED_OP)
5062 #  define HAVE_ANY_OP 1
5063 #endif
5064 
5065 #if defined(DO_DECOMPRESS)
5066 LZO_PUBLIC(int)
DO_DECOMPRESS(const lzo_bytep in,lzo_uint in_len,lzo_bytep out,lzo_uintp out_len,lzo_voidp wrkmem)5067 DO_DECOMPRESS  ( const lzo_bytep in , lzo_uint  in_len,
5068                        lzo_bytep out, lzo_uintp out_len,
5069                        lzo_voidp wrkmem )
5070 #endif
5071 {
5072     lzo_bytep op;
5073     const lzo_bytep ip;
5074     lzo_uint t;
5075 #if defined(COPY_DICT)
5076     lzo_uint m_off;
5077     const lzo_bytep dict_end;
5078 #else
5079     const lzo_bytep m_pos;
5080 #endif
5081 
5082     const lzo_bytep const ip_end = in + in_len;
5083 #if defined(HAVE_ANY_OP)
5084     lzo_bytep const op_end = out + *out_len;
5085 #endif
5086 #if defined(LZO1Z)
5087     lzo_uint last_m_off = 0;
5088 #endif
5089 
5090     LZO_UNUSED(wrkmem);
5091 
5092 #if defined(COPY_DICT)
5093     if (dict)
5094     {
5095         if (dict_len > M4_MAX_OFFSET)
5096         {
5097             dict += dict_len - M4_MAX_OFFSET;
5098             dict_len = M4_MAX_OFFSET;
5099         }
5100         dict_end = dict + dict_len;
5101     }
5102     else
5103     {
5104         dict_len = 0;
5105         dict_end = NULL;
5106     }
5107 #endif
5108 
5109     *out_len = 0;
5110 
5111     op = out;
5112     ip = in;
5113 
5114     NEED_IP(1);
5115     if (*ip > 17)
5116     {
5117         t = *ip++ - 17;
5118         if (t < 4)
5119             goto match_next;
5120         assert(t > 0); NEED_OP(t); NEED_IP(t+3);
5121         do *op++ = *ip++; while (--t > 0);
5122         goto first_literal_run;
5123     }
5124 
5125     for (;;)
5126     {
5127         NEED_IP(3);
5128         t = *ip++;
5129         if (t >= 16)
5130             goto match;
5131         if (t == 0)
5132         {
5133             while (*ip == 0)
5134             {
5135                 t += 255;
5136                 ip++;
5137                 TEST_IV(t);
5138                 NEED_IP(1);
5139             }
5140             t += 15 + *ip++;
5141         }
5142         assert(t > 0); NEED_OP(t+3); NEED_IP(t+6);
5143 #if (LZO_OPT_UNALIGNED64) && (LZO_OPT_UNALIGNED32)
5144         t += 3;
5145         if (t >= 8) do
5146         {
5147             UA_COPY8(op,ip);
5148             op += 8; ip += 8; t -= 8;
5149         } while (t >= 8);
5150         if (t >= 4)
5151         {
5152             UA_COPY4(op,ip);
5153             op += 4; ip += 4; t -= 4;
5154         }
5155         if (t > 0)
5156         {
5157             *op++ = *ip++;
5158             if (t > 1) { *op++ = *ip++; if (t > 2) { *op++ = *ip++; } }
5159         }
5160 #elif (LZO_OPT_UNALIGNED32) || (LZO_ALIGNED_OK_4)
5161 #if !(LZO_OPT_UNALIGNED32)
5162         if (PTR_ALIGNED2_4(op,ip))
5163         {
5164 #endif
5165         UA_COPY4(op,ip);
5166         op += 4; ip += 4;
5167         if (--t > 0)
5168         {
5169             if (t >= 4)
5170             {
5171                 do {
5172                     UA_COPY4(op,ip);
5173                     op += 4; ip += 4; t -= 4;
5174                 } while (t >= 4);
5175                 if (t > 0) do *op++ = *ip++; while (--t > 0);
5176             }
5177             else
5178                 do *op++ = *ip++; while (--t > 0);
5179         }
5180 #if !(LZO_OPT_UNALIGNED32)
5181         }
5182         else
5183 #endif
5184 #endif
5185 #if !(LZO_OPT_UNALIGNED32)
5186         {
5187             *op++ = *ip++; *op++ = *ip++; *op++ = *ip++;
5188             do *op++ = *ip++; while (--t > 0);
5189         }
5190 #endif
5191 
5192 first_literal_run:
5193 
5194         t = *ip++;
5195         if (t >= 16)
5196             goto match;
5197 #if defined(COPY_DICT)
5198 #if defined(LZO1Z)
5199         m_off = (1 + M2_MAX_OFFSET) + (t << 6) + (*ip++ >> 2);
5200         last_m_off = m_off;
5201 #else
5202         m_off = (1 + M2_MAX_OFFSET) + (t >> 2) + (*ip++ << 2);
5203 #endif
5204         NEED_OP(3);
5205         t = 3; COPY_DICT(t,m_off)
5206 #else
5207 #if defined(LZO1Z)
5208         t = (1 + M2_MAX_OFFSET) + (t << 6) + (*ip++ >> 2);
5209         m_pos = op - t;
5210         last_m_off = t;
5211 #else
5212         m_pos = op - (1 + M2_MAX_OFFSET);
5213         m_pos -= t >> 2;
5214         m_pos -= *ip++ << 2;
5215 #endif
5216         TEST_LB(m_pos); NEED_OP(3);
5217         *op++ = *m_pos++; *op++ = *m_pos++; *op++ = *m_pos;
5218 #endif
5219         goto match_done;
5220 
5221         for (;;) {
5222 match:
5223             if (t >= 64)
5224             {
5225 #if defined(COPY_DICT)
5226 #if defined(LZO1X)
5227                 m_off = 1 + ((t >> 2) & 7) + (*ip++ << 3);
5228                 t = (t >> 5) - 1;
5229 #elif defined(LZO1Y)
5230                 m_off = 1 + ((t >> 2) & 3) + (*ip++ << 2);
5231                 t = (t >> 4) - 3;
5232 #elif defined(LZO1Z)
5233                 m_off = t & 0x1f;
5234                 if (m_off >= 0x1c)
5235                     m_off = last_m_off;
5236                 else
5237                 {
5238                     m_off = 1 + (m_off << 6) + (*ip++ >> 2);
5239                     last_m_off = m_off;
5240                 }
5241                 t = (t >> 5) - 1;
5242 #endif
5243 #else
5244 #if defined(LZO1X)
5245                 m_pos = op - 1;
5246                 m_pos -= (t >> 2) & 7;
5247                 m_pos -= *ip++ << 3;
5248                 t = (t >> 5) - 1;
5249 #elif defined(LZO1Y)
5250                 m_pos = op - 1;
5251                 m_pos -= (t >> 2) & 3;
5252                 m_pos -= *ip++ << 2;
5253                 t = (t >> 4) - 3;
5254 #elif defined(LZO1Z)
5255                 {
5256                     lzo_uint off = t & 0x1f;
5257                     m_pos = op;
5258                     if (off >= 0x1c)
5259                     {
5260                         assert(last_m_off > 0);
5261                         m_pos -= last_m_off;
5262                     }
5263                     else
5264                     {
5265                         off = 1 + (off << 6) + (*ip++ >> 2);
5266                         m_pos -= off;
5267                         last_m_off = off;
5268                     }
5269                 }
5270                 t = (t >> 5) - 1;
5271 #endif
5272                 TEST_LB(m_pos); assert(t > 0); NEED_OP(t+3-1);
5273                 goto copy_match;
5274 #endif
5275             }
5276             else if (t >= 32)
5277             {
5278                 t &= 31;
5279                 if (t == 0)
5280                 {
5281                     while (*ip == 0)
5282                     {
5283                         t += 255;
5284                         ip++;
5285                         TEST_OV(t);
5286                         NEED_IP(1);
5287                     }
5288                     t += 31 + *ip++;
5289                     NEED_IP(2);
5290                 }
5291 #if defined(COPY_DICT)
5292 #if defined(LZO1Z)
5293                 m_off = 1 + (ip[0] << 6) + (ip[1] >> 2);
5294                 last_m_off = m_off;
5295 #else
5296                 m_off = 1 + (ip[0] >> 2) + (ip[1] << 6);
5297 #endif
5298 #else
5299 #if defined(LZO1Z)
5300                 {
5301                     lzo_uint off = 1 + (ip[0] << 6) + (ip[1] >> 2);
5302                     m_pos = op - off;
5303                     last_m_off = off;
5304                 }
5305 #elif (LZO_OPT_UNALIGNED16) && (LZO_ABI_LITTLE_ENDIAN)
5306                 m_pos = op - 1;
5307                 m_pos -= UA_GET_LE16(ip) >> 2;
5308 #else
5309                 m_pos = op - 1;
5310                 m_pos -= (ip[0] >> 2) + (ip[1] << 6);
5311 #endif
5312 #endif
5313                 ip += 2;
5314             }
5315             else if (t >= 16)
5316             {
5317 #if defined(COPY_DICT)
5318                 m_off = (t & 8) << 11;
5319 #else
5320                 m_pos = op;
5321                 m_pos -= (t & 8) << 11;
5322 #endif
5323                 t &= 7;
5324                 if (t == 0)
5325                 {
5326                     while (*ip == 0)
5327                     {
5328                         t += 255;
5329                         ip++;
5330                         TEST_OV(t);
5331                         NEED_IP(1);
5332                     }
5333                     t += 7 + *ip++;
5334                     NEED_IP(2);
5335                 }
5336 #if defined(COPY_DICT)
5337 #if defined(LZO1Z)
5338                 m_off += (ip[0] << 6) + (ip[1] >> 2);
5339 #else
5340                 m_off += (ip[0] >> 2) + (ip[1] << 6);
5341 #endif
5342                 ip += 2;
5343                 if (m_off == 0)
5344                     goto eof_found;
5345                 m_off += 0x4000;
5346 #if defined(LZO1Z)
5347                 last_m_off = m_off;
5348 #endif
5349 #else
5350 #if defined(LZO1Z)
5351                 m_pos -= (ip[0] << 6) + (ip[1] >> 2);
5352 #elif (LZO_OPT_UNALIGNED16) && (LZO_ABI_LITTLE_ENDIAN)
5353                 m_pos -= UA_GET_LE16(ip) >> 2;
5354 #else
5355                 m_pos -= (ip[0] >> 2) + (ip[1] << 6);
5356 #endif
5357                 ip += 2;
5358                 if (m_pos == op)
5359                     goto eof_found;
5360                 m_pos -= 0x4000;
5361 #if defined(LZO1Z)
5362                 last_m_off = pd((const lzo_bytep)op, m_pos);
5363 #endif
5364 #endif
5365             }
5366             else
5367             {
5368 #if defined(COPY_DICT)
5369 #if defined(LZO1Z)
5370                 m_off = 1 + (t << 6) + (*ip++ >> 2);
5371                 last_m_off = m_off;
5372 #else
5373                 m_off = 1 + (t >> 2) + (*ip++ << 2);
5374 #endif
5375                 NEED_OP(2);
5376                 t = 2; COPY_DICT(t,m_off)
5377 #else
5378 #if defined(LZO1Z)
5379                 t = 1 + (t << 6) + (*ip++ >> 2);
5380                 m_pos = op - t;
5381                 last_m_off = t;
5382 #else
5383                 m_pos = op - 1;
5384                 m_pos -= t >> 2;
5385                 m_pos -= *ip++ << 2;
5386 #endif
5387                 TEST_LB(m_pos); NEED_OP(2);
5388                 *op++ = *m_pos++; *op++ = *m_pos;
5389 #endif
5390                 goto match_done;
5391             }
5392 
5393 #if defined(COPY_DICT)
5394 
5395             NEED_OP(t+3-1);
5396             t += 3-1; COPY_DICT(t,m_off)
5397 
5398 #else
5399 
5400             TEST_LB(m_pos); assert(t > 0); NEED_OP(t+3-1);
5401 #if (LZO_OPT_UNALIGNED64) && (LZO_OPT_UNALIGNED32)
5402             if (op - m_pos >= 8)
5403             {
5404                 t += (3 - 1);
5405                 if (t >= 8) do
5406                 {
5407                     UA_COPY8(op,m_pos);
5408                     op += 8; m_pos += 8; t -= 8;
5409                 } while (t >= 8);
5410                 if (t >= 4)
5411                 {
5412                     UA_COPY4(op,m_pos);
5413                     op += 4; m_pos += 4; t -= 4;
5414                 }
5415                 if (t > 0)
5416                 {
5417                     *op++ = m_pos[0];
5418                     if (t > 1) { *op++ = m_pos[1]; if (t > 2) { *op++ = m_pos[2]; } }
5419                 }
5420             }
5421             else
5422 #elif (LZO_OPT_UNALIGNED32) || (LZO_ALIGNED_OK_4)
5423 #if !(LZO_OPT_UNALIGNED32)
5424             if (t >= 2 * 4 - (3 - 1) && PTR_ALIGNED2_4(op,m_pos))
5425             {
5426                 assert((op - m_pos) >= 4);
5427 #else
5428             if (t >= 2 * 4 - (3 - 1) && (op - m_pos) >= 4)
5429             {
5430 #endif
5431                 UA_COPY4(op,m_pos);
5432                 op += 4; m_pos += 4; t -= 4 - (3 - 1);
5433                 do {
5434                     UA_COPY4(op,m_pos);
5435                     op += 4; m_pos += 4; t -= 4;
5436                 } while (t >= 4);
5437                 if (t > 0) do *op++ = *m_pos++; while (--t > 0);
5438             }
5439             else
5440 #endif
5441             {
5442 copy_match:
5443                 *op++ = *m_pos++; *op++ = *m_pos++;
5444                 do *op++ = *m_pos++; while (--t > 0);
5445             }
5446 
5447 #endif
5448 
5449 match_done:
5450 #if defined(LZO1Z)
5451             t = ip[-1] & 3;
5452 #else
5453             t = ip[-2] & 3;
5454 #endif
5455             if (t == 0)
5456                 break;
5457 
5458 match_next:
5459             assert(t > 0); assert(t < 4); NEED_OP(t); NEED_IP(t+3);
5460 #if 0
5461             do *op++ = *ip++; while (--t > 0);
5462 #else
5463             *op++ = *ip++;
5464             if (t > 1) { *op++ = *ip++; if (t > 2) { *op++ = *ip++; } }
5465 #endif
5466             t = *ip++;
5467         }
5468     }
5469 
5470 eof_found:
5471     *out_len = pd(op, out);
5472     return (ip == ip_end ? LZO_E_OK :
5473            (ip < ip_end  ? LZO_E_INPUT_NOT_CONSUMED : LZO_E_INPUT_OVERRUN));
5474 
5475 #if defined(HAVE_NEED_IP)
5476 input_overrun:
5477     *out_len = pd(op, out);
5478     return LZO_E_INPUT_OVERRUN;
5479 #endif
5480 
5481 #if defined(HAVE_NEED_OP)
5482 output_overrun:
5483     *out_len = pd(op, out);
5484     return LZO_E_OUTPUT_OVERRUN;
5485 #endif
5486 
5487 #if defined(LZO_TEST_OVERRUN_LOOKBEHIND)
5488 lookbehind_overrun:
5489     *out_len = pd(op, out);
5490     return LZO_E_LOOKBEHIND_OVERRUN;
5491 #endif
5492 }
5493 
5494 #endif
5495 
5496 #define LZO_TEST_OVERRUN 1
5497 #undef DO_DECOMPRESS
5498 #define DO_DECOMPRESS       lzo1x_decompress_safe
5499 
5500 #if !defined(MINILZO_CFG_SKIP_LZO1X_DECOMPRESS_SAFE)
5501 
5502 #if defined(LZO_TEST_OVERRUN)
5503 #  if !defined(LZO_TEST_OVERRUN_INPUT)
5504 #    define LZO_TEST_OVERRUN_INPUT       2
5505 #  endif
5506 #  if !defined(LZO_TEST_OVERRUN_OUTPUT)
5507 #    define LZO_TEST_OVERRUN_OUTPUT      2
5508 #  endif
5509 #  if !defined(LZO_TEST_OVERRUN_LOOKBEHIND)
5510 #    define LZO_TEST_OVERRUN_LOOKBEHIND  1
5511 #  endif
5512 #endif
5513 
5514 #undef TEST_IP
5515 #undef TEST_OP
5516 #undef TEST_IP_AND_TEST_OP
5517 #undef TEST_LB
5518 #undef TEST_LBO
5519 #undef NEED_IP
5520 #undef NEED_OP
5521 #undef TEST_IV
5522 #undef TEST_OV
5523 #undef HAVE_TEST_IP
5524 #undef HAVE_TEST_OP
5525 #undef HAVE_NEED_IP
5526 #undef HAVE_NEED_OP
5527 #undef HAVE_ANY_IP
5528 #undef HAVE_ANY_OP
5529 
5530 #if defined(LZO_TEST_OVERRUN_INPUT)
5531 #  if (LZO_TEST_OVERRUN_INPUT >= 1)
5532 #    define TEST_IP             (ip < ip_end)
5533 #  endif
5534 #  if (LZO_TEST_OVERRUN_INPUT >= 2)
5535 #    define NEED_IP(x) \
5536             if ((lzo_uint)(ip_end - ip) < (lzo_uint)(x))  goto input_overrun
5537 #    define TEST_IV(x)          if ((x) >  (lzo_uint)0 - (511)) goto input_overrun
5538 #  endif
5539 #endif
5540 
5541 #if defined(LZO_TEST_OVERRUN_OUTPUT)
5542 #  if (LZO_TEST_OVERRUN_OUTPUT >= 1)
5543 #    define TEST_OP             (op <= op_end)
5544 #  endif
5545 #  if (LZO_TEST_OVERRUN_OUTPUT >= 2)
5546 #    undef TEST_OP
5547 #    define NEED_OP(x) \
5548             if ((lzo_uint)(op_end - op) < (lzo_uint)(x))  goto output_overrun
5549 #    define TEST_OV(x)          if ((x) >  (lzo_uint)0 - (511)) goto output_overrun
5550 #  endif
5551 #endif
5552 
5553 #if defined(LZO_TEST_OVERRUN_LOOKBEHIND)
5554 #  define TEST_LB(m_pos)        if (PTR_LT(m_pos,out) || PTR_GE(m_pos,op)) goto lookbehind_overrun
5555 #  define TEST_LBO(m_pos,o)     if (PTR_LT(m_pos,out) || PTR_GE(m_pos,op-(o))) goto lookbehind_overrun
5556 #else
5557 #  define TEST_LB(m_pos)        ((void) 0)
5558 #  define TEST_LBO(m_pos,o)     ((void) 0)
5559 #endif
5560 
5561 #if !defined(LZO_EOF_CODE) && !defined(TEST_IP)
5562 #  define TEST_IP               (ip < ip_end)
5563 #endif
5564 
5565 #if defined(TEST_IP)
5566 #  define HAVE_TEST_IP 1
5567 #else
5568 #  define TEST_IP               1
5569 #endif
5570 #if defined(TEST_OP)
5571 #  define HAVE_TEST_OP 1
5572 #else
5573 #  define TEST_OP               1
5574 #endif
5575 
5576 #if defined(HAVE_TEST_IP) && defined(HAVE_TEST_OP)
5577 #  define TEST_IP_AND_TEST_OP   (TEST_IP && TEST_OP)
5578 #elif defined(HAVE_TEST_IP)
5579 #  define TEST_IP_AND_TEST_OP   TEST_IP
5580 #elif defined(HAVE_TEST_OP)
5581 #  define TEST_IP_AND_TEST_OP   TEST_OP
5582 #else
5583 #  define TEST_IP_AND_TEST_OP   1
5584 #endif
5585 
5586 #if defined(NEED_IP)
5587 #  define HAVE_NEED_IP 1
5588 #else
5589 #  define NEED_IP(x)            ((void) 0)
5590 #  define TEST_IV(x)            ((void) 0)
5591 #endif
5592 #if defined(NEED_OP)
5593 #  define HAVE_NEED_OP 1
5594 #else
5595 #  define NEED_OP(x)            ((void) 0)
5596 #  define TEST_OV(x)            ((void) 0)
5597 #endif
5598 
5599 #if defined(HAVE_TEST_IP) || defined(HAVE_NEED_IP)
5600 #  define HAVE_ANY_IP 1
5601 #endif
5602 #if defined(HAVE_TEST_OP) || defined(HAVE_NEED_OP)
5603 #  define HAVE_ANY_OP 1
5604 #endif
5605 
5606 #if defined(DO_DECOMPRESS)
5607 LZO_PUBLIC(int)
5608 DO_DECOMPRESS  ( const lzo_bytep in , lzo_uint  in_len,
5609                        lzo_bytep out, lzo_uintp out_len,
5610                        lzo_voidp wrkmem )
5611 #endif
5612 {
5613     lzo_bytep op;
5614     const lzo_bytep ip;
5615     lzo_uint t;
5616 #if defined(COPY_DICT)
5617     lzo_uint m_off;
5618     const lzo_bytep dict_end;
5619 #else
5620     const lzo_bytep m_pos;
5621 #endif
5622 
5623     const lzo_bytep const ip_end = in + in_len;
5624 #if defined(HAVE_ANY_OP)
5625     lzo_bytep const op_end = out + *out_len;
5626 #endif
5627 #if defined(LZO1Z)
5628     lzo_uint last_m_off = 0;
5629 #endif
5630 
5631     LZO_UNUSED(wrkmem);
5632 
5633 #if defined(COPY_DICT)
5634     if (dict)
5635     {
5636         if (dict_len > M4_MAX_OFFSET)
5637         {
5638             dict += dict_len - M4_MAX_OFFSET;
5639             dict_len = M4_MAX_OFFSET;
5640         }
5641         dict_end = dict + dict_len;
5642     }
5643     else
5644     {
5645         dict_len = 0;
5646         dict_end = NULL;
5647     }
5648 #endif
5649 
5650     *out_len = 0;
5651 
5652     op = out;
5653     ip = in;
5654 
5655     NEED_IP(1);
5656     if (*ip > 17)
5657     {
5658         t = *ip++ - 17;
5659         if (t < 4)
5660             goto match_next;
5661         assert(t > 0); NEED_OP(t); NEED_IP(t+3);
5662         do *op++ = *ip++; while (--t > 0);
5663         goto first_literal_run;
5664     }
5665 
5666     for (;;)
5667     {
5668         NEED_IP(3);
5669         t = *ip++;
5670         if (t >= 16)
5671             goto match;
5672         if (t == 0)
5673         {
5674             while (*ip == 0)
5675             {
5676                 t += 255;
5677                 ip++;
5678                 TEST_IV(t);
5679                 NEED_IP(1);
5680             }
5681             t += 15 + *ip++;
5682         }
5683         assert(t > 0); NEED_OP(t+3); NEED_IP(t+6);
5684 #if (LZO_OPT_UNALIGNED64) && (LZO_OPT_UNALIGNED32)
5685         t += 3;
5686         if (t >= 8) do
5687         {
5688             UA_COPY8(op,ip);
5689             op += 8; ip += 8; t -= 8;
5690         } while (t >= 8);
5691         if (t >= 4)
5692         {
5693             UA_COPY4(op,ip);
5694             op += 4; ip += 4; t -= 4;
5695         }
5696         if (t > 0)
5697         {
5698             *op++ = *ip++;
5699             if (t > 1) { *op++ = *ip++; if (t > 2) { *op++ = *ip++; } }
5700         }
5701 #elif (LZO_OPT_UNALIGNED32) || (LZO_ALIGNED_OK_4)
5702 #if !(LZO_OPT_UNALIGNED32)
5703         if (PTR_ALIGNED2_4(op,ip))
5704         {
5705 #endif
5706         UA_COPY4(op,ip);
5707         op += 4; ip += 4;
5708         if (--t > 0)
5709         {
5710             if (t >= 4)
5711             {
5712                 do {
5713                     UA_COPY4(op,ip);
5714                     op += 4; ip += 4; t -= 4;
5715                 } while (t >= 4);
5716                 if (t > 0) do *op++ = *ip++; while (--t > 0);
5717             }
5718             else
5719                 do *op++ = *ip++; while (--t > 0);
5720         }
5721 #if !(LZO_OPT_UNALIGNED32)
5722         }
5723         else
5724 #endif
5725 #endif
5726 #if !(LZO_OPT_UNALIGNED32)
5727         {
5728             *op++ = *ip++; *op++ = *ip++; *op++ = *ip++;
5729             do *op++ = *ip++; while (--t > 0);
5730         }
5731 #endif
5732 
5733 first_literal_run:
5734 
5735         t = *ip++;
5736         if (t >= 16)
5737             goto match;
5738 #if defined(COPY_DICT)
5739 #if defined(LZO1Z)
5740         m_off = (1 + M2_MAX_OFFSET) + (t << 6) + (*ip++ >> 2);
5741         last_m_off = m_off;
5742 #else
5743         m_off = (1 + M2_MAX_OFFSET) + (t >> 2) + (*ip++ << 2);
5744 #endif
5745         NEED_OP(3);
5746         t = 3; COPY_DICT(t,m_off)
5747 #else
5748 #if defined(LZO1Z)
5749         t = (1 + M2_MAX_OFFSET) + (t << 6) + (*ip++ >> 2);
5750         m_pos = op - t;
5751         last_m_off = t;
5752 #else
5753         m_pos = op - (1 + M2_MAX_OFFSET);
5754         m_pos -= t >> 2;
5755         m_pos -= *ip++ << 2;
5756 #endif
5757         TEST_LB(m_pos); NEED_OP(3);
5758         *op++ = *m_pos++; *op++ = *m_pos++; *op++ = *m_pos;
5759 #endif
5760         goto match_done;
5761 
5762         for (;;) {
5763 match:
5764             if (t >= 64)
5765             {
5766 #if defined(COPY_DICT)
5767 #if defined(LZO1X)
5768                 m_off = 1 + ((t >> 2) & 7) + (*ip++ << 3);
5769                 t = (t >> 5) - 1;
5770 #elif defined(LZO1Y)
5771                 m_off = 1 + ((t >> 2) & 3) + (*ip++ << 2);
5772                 t = (t >> 4) - 3;
5773 #elif defined(LZO1Z)
5774                 m_off = t & 0x1f;
5775                 if (m_off >= 0x1c)
5776                     m_off = last_m_off;
5777                 else
5778                 {
5779                     m_off = 1 + (m_off << 6) + (*ip++ >> 2);
5780                     last_m_off = m_off;
5781                 }
5782                 t = (t >> 5) - 1;
5783 #endif
5784 #else
5785 #if defined(LZO1X)
5786                 m_pos = op - 1;
5787                 m_pos -= (t >> 2) & 7;
5788                 m_pos -= *ip++ << 3;
5789                 t = (t >> 5) - 1;
5790 #elif defined(LZO1Y)
5791                 m_pos = op - 1;
5792                 m_pos -= (t >> 2) & 3;
5793                 m_pos -= *ip++ << 2;
5794                 t = (t >> 4) - 3;
5795 #elif defined(LZO1Z)
5796                 {
5797                     lzo_uint off = t & 0x1f;
5798                     m_pos = op;
5799                     if (off >= 0x1c)
5800                     {
5801                         assert(last_m_off > 0);
5802                         m_pos -= last_m_off;
5803                     }
5804                     else
5805                     {
5806                         off = 1 + (off << 6) + (*ip++ >> 2);
5807                         m_pos -= off;
5808                         last_m_off = off;
5809                     }
5810                 }
5811                 t = (t >> 5) - 1;
5812 #endif
5813                 TEST_LB(m_pos); assert(t > 0); NEED_OP(t+3-1);
5814                 goto copy_match;
5815 #endif
5816             }
5817             else if (t >= 32)
5818             {
5819                 t &= 31;
5820                 if (t == 0)
5821                 {
5822                     while (*ip == 0)
5823                     {
5824                         t += 255;
5825                         ip++;
5826                         TEST_OV(t);
5827                         NEED_IP(1);
5828                     }
5829                     t += 31 + *ip++;
5830                     NEED_IP(2);
5831                 }
5832 #if defined(COPY_DICT)
5833 #if defined(LZO1Z)
5834                 m_off = 1 + (ip[0] << 6) + (ip[1] >> 2);
5835                 last_m_off = m_off;
5836 #else
5837                 m_off = 1 + (ip[0] >> 2) + (ip[1] << 6);
5838 #endif
5839 #else
5840 #if defined(LZO1Z)
5841                 {
5842                     lzo_uint off = 1 + (ip[0] << 6) + (ip[1] >> 2);
5843                     m_pos = op - off;
5844                     last_m_off = off;
5845                 }
5846 #elif (LZO_OPT_UNALIGNED16) && (LZO_ABI_LITTLE_ENDIAN)
5847                 m_pos = op - 1;
5848                 m_pos -= UA_GET_LE16(ip) >> 2;
5849 #else
5850                 m_pos = op - 1;
5851                 m_pos -= (ip[0] >> 2) + (ip[1] << 6);
5852 #endif
5853 #endif
5854                 ip += 2;
5855             }
5856             else if (t >= 16)
5857             {
5858 #if defined(COPY_DICT)
5859                 m_off = (t & 8) << 11;
5860 #else
5861                 m_pos = op;
5862                 m_pos -= (t & 8) << 11;
5863 #endif
5864                 t &= 7;
5865                 if (t == 0)
5866                 {
5867                     while (*ip == 0)
5868                     {
5869                         t += 255;
5870                         ip++;
5871                         TEST_OV(t);
5872                         NEED_IP(1);
5873                     }
5874                     t += 7 + *ip++;
5875                     NEED_IP(2);
5876                 }
5877 #if defined(COPY_DICT)
5878 #if defined(LZO1Z)
5879                 m_off += (ip[0] << 6) + (ip[1] >> 2);
5880 #else
5881                 m_off += (ip[0] >> 2) + (ip[1] << 6);
5882 #endif
5883                 ip += 2;
5884                 if (m_off == 0)
5885                     goto eof_found;
5886                 m_off += 0x4000;
5887 #if defined(LZO1Z)
5888                 last_m_off = m_off;
5889 #endif
5890 #else
5891 #if defined(LZO1Z)
5892                 m_pos -= (ip[0] << 6) + (ip[1] >> 2);
5893 #elif (LZO_OPT_UNALIGNED16) && (LZO_ABI_LITTLE_ENDIAN)
5894                 m_pos -= UA_GET_LE16(ip) >> 2;
5895 #else
5896                 m_pos -= (ip[0] >> 2) + (ip[1] << 6);
5897 #endif
5898                 ip += 2;
5899                 if (m_pos == op)
5900                     goto eof_found;
5901                 m_pos -= 0x4000;
5902 #if defined(LZO1Z)
5903                 last_m_off = pd((const lzo_bytep)op, m_pos);
5904 #endif
5905 #endif
5906             }
5907             else
5908             {
5909 #if defined(COPY_DICT)
5910 #if defined(LZO1Z)
5911                 m_off = 1 + (t << 6) + (*ip++ >> 2);
5912                 last_m_off = m_off;
5913 #else
5914                 m_off = 1 + (t >> 2) + (*ip++ << 2);
5915 #endif
5916                 NEED_OP(2);
5917                 t = 2; COPY_DICT(t,m_off)
5918 #else
5919 #if defined(LZO1Z)
5920                 t = 1 + (t << 6) + (*ip++ >> 2);
5921                 m_pos = op - t;
5922                 last_m_off = t;
5923 #else
5924                 m_pos = op - 1;
5925                 m_pos -= t >> 2;
5926                 m_pos -= *ip++ << 2;
5927 #endif
5928                 TEST_LB(m_pos); NEED_OP(2);
5929                 *op++ = *m_pos++; *op++ = *m_pos;
5930 #endif
5931                 goto match_done;
5932             }
5933 
5934 #if defined(COPY_DICT)
5935 
5936             NEED_OP(t+3-1);
5937             t += 3-1; COPY_DICT(t,m_off)
5938 
5939 #else
5940 
5941             TEST_LB(m_pos); assert(t > 0); NEED_OP(t+3-1);
5942 #if (LZO_OPT_UNALIGNED64) && (LZO_OPT_UNALIGNED32)
5943             if (op - m_pos >= 8)
5944             {
5945                 t += (3 - 1);
5946                 if (t >= 8) do
5947                 {
5948                     UA_COPY8(op,m_pos);
5949                     op += 8; m_pos += 8; t -= 8;
5950                 } while (t >= 8);
5951                 if (t >= 4)
5952                 {
5953                     UA_COPY4(op,m_pos);
5954                     op += 4; m_pos += 4; t -= 4;
5955                 }
5956                 if (t > 0)
5957                 {
5958                     *op++ = m_pos[0];
5959                     if (t > 1) { *op++ = m_pos[1]; if (t > 2) { *op++ = m_pos[2]; } }
5960                 }
5961             }
5962             else
5963 #elif (LZO_OPT_UNALIGNED32) || (LZO_ALIGNED_OK_4)
5964 #if !(LZO_OPT_UNALIGNED32)
5965             if (t >= 2 * 4 - (3 - 1) && PTR_ALIGNED2_4(op,m_pos))
5966             {
5967                 assert((op - m_pos) >= 4);
5968 #else
5969             if (t >= 2 * 4 - (3 - 1) && (op - m_pos) >= 4)
5970             {
5971 #endif
5972                 UA_COPY4(op,m_pos);
5973                 op += 4; m_pos += 4; t -= 4 - (3 - 1);
5974                 do {
5975                     UA_COPY4(op,m_pos);
5976                     op += 4; m_pos += 4; t -= 4;
5977                 } while (t >= 4);
5978                 if (t > 0) do *op++ = *m_pos++; while (--t > 0);
5979             }
5980             else
5981 #endif
5982             {
5983 copy_match:
5984                 *op++ = *m_pos++; *op++ = *m_pos++;
5985                 do *op++ = *m_pos++; while (--t > 0);
5986             }
5987 
5988 #endif
5989 
5990 match_done:
5991 #if defined(LZO1Z)
5992             t = ip[-1] & 3;
5993 #else
5994             t = ip[-2] & 3;
5995 #endif
5996             if (t == 0)
5997                 break;
5998 
5999 match_next:
6000             assert(t > 0); assert(t < 4); NEED_OP(t); NEED_IP(t+3);
6001 #if 0
6002             do *op++ = *ip++; while (--t > 0);
6003 #else
6004             *op++ = *ip++;
6005             if (t > 1) { *op++ = *ip++; if (t > 2) { *op++ = *ip++; } }
6006 #endif
6007             t = *ip++;
6008         }
6009     }
6010 
6011 eof_found:
6012     *out_len = pd(op, out);
6013     return (ip == ip_end ? LZO_E_OK :
6014            (ip < ip_end  ? LZO_E_INPUT_NOT_CONSUMED : LZO_E_INPUT_OVERRUN));
6015 
6016 #if defined(HAVE_NEED_IP)
6017 input_overrun:
6018     *out_len = pd(op, out);
6019     return LZO_E_INPUT_OVERRUN;
6020 #endif
6021 
6022 #if defined(HAVE_NEED_OP)
6023 output_overrun:
6024     *out_len = pd(op, out);
6025     return LZO_E_OUTPUT_OVERRUN;
6026 #endif
6027 
6028 #if defined(LZO_TEST_OVERRUN_LOOKBEHIND)
6029 lookbehind_overrun:
6030     *out_len = pd(op, out);
6031     return LZO_E_LOOKBEHIND_OVERRUN;
6032 #endif
6033 }
6034 
6035 #endif
6036 
6037 /***** End of minilzo.c *****/
6038