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