Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
lzo_conf.h
Go to the documentation of this file.
1/*
2** Command & Conquer Generals Zero Hour(tm)
3** Copyright 2025 Electronic Arts Inc.
4**
5** This program is free software: you can redistribute it and/or modify
6** it under the terms of the GNU General Public License as published by
7** the Free Software Foundation, either version 3 of the License, or
8** (at your option) any later version.
9**
10** This program is distributed in the hope that it will be useful,
11** but WITHOUT ANY WARRANTY; without even the implied warranty of
12** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13** GNU General Public License for more details.
14**
15** You should have received a copy of the GNU General Public License
16** along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/
18
19/***********************************************************************************************
20 *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
21 ***********************************************************************************************
22 * *
23 * Project Name : Command & Conquer *
24 * *
25 * $Archive:: /Commando/Library/lzo_conf.h $*
26 * *
27 * $Author:: Greg_h $*
28 * *
29 * $Modtime:: 7/22/97 11:37a $*
30 * *
31 * $Revision:: 1 $*
32 * *
33 *---------------------------------------------------------------------------------------------*
34 * Functions: *
35 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
36
37/* lzo_conf.h -- main internal configuration file for the the LZO library
38
39 This file is part of the LZO real-time data compression library.
40
41 Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer
42
43 The LZO library is free software; you can redistribute it and/or
44 modify it under the terms of the GNU Library General Public
45 License as published by the Free Software Foundation; either
46 version 2 of the License, or (at your option) any later version.
47
48 The LZO library is distributed in the hope that it will be useful,
49 but WITHOUT ANY WARRANTY; without even the implied warranty of
50 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
51 Library General Public License for more details.
52
53 You should have received a copy of the GNU Library General Public
54 License along with the LZO library; see the file COPYING.LIB.
55 If not, write to the Free Software Foundation, Inc.,
56 675 Mass Ave, Cambridge, MA 02139, USA.
57
58 Markus F.X.J. Oberhumer
59 markus.oberhumer@jk.uni-linz.ac.at
60 */
61
62
63/* WARNING: this file should *not* be used by applications. It is
64 part of the implementation of the library and is subject
65 to change.
66 */
67
68
69#ifndef __LZO_CONF_H
70#define __LZO_CONF_H
71
72#ifndef __LZOCONF_H
73# include "lzoconf.h"
74#endif
75
76
77/***********************************************************************
78// compiler specific defines
79************************************************************************/
80
81/* need Borland C 4.0 or above because of huge-pointer bugs */
82#if defined(__LZO_MSDOS16) && defined(__TURBOC__)
83# if (__TURBOC__ < 0x452)
84# error You need a newer compiler version
85# endif
86#endif
87
88#if defined(__LZO_MSDOS) || defined(__i386__) || defined(__386__)
89# if !defined(__LZO_i386)
90# define __LZO_i386
91# endif
92#endif
93
94
95/***********************************************************************
96//
97************************************************************************/
98
99#include <stddef.h> /* ptrdiff_t, size_t */
100#include <string.h> /* memcpy, memmove, memcmp, memset */
101
102#if 0 && !defined(assert)
103# error <assert.h> not included
104#endif
105
106#if defined(__BOUNDS_CHECKING_ON)
107# include <unchecked.h>
108#else
109# define BOUNDS_CHECKING_OFF_DURING(stmt) stmt
110# define BOUNDS_CHECKING_OFF_IN_EXPR(expr) (expr)
111#endif
112
113/* ptrdiff_t */
114#if (UINT_MAX >= 0xffffffffL)
115 typedef ptrdiff_t lzo_ptrdiff_t;
116#else
117 typedef long lzo_ptrdiff_t;
118#endif
119
120
121#ifdef __cplusplus
122# define LZO_UNUSED(parm)
123#else
124# define LZO_UNUSED(parm) parm
125#endif
126
127
128#if !defined(__inline__) && !defined(__GNUC__)
129# if defined(__cplusplus)
130# define __inline__ inline
131# else
132# define __inline__ /* nothing */
133# endif
134#endif
135
136
137/***********************************************************************
138// compiler and architecture specific stuff
139************************************************************************/
140
141/* Some defines that indicate if memory can be accessed at unaligned
142 * addresses. You should also test that this is actually faster if
143 * it is allowed by your system.
144 */
145
146#if 1 && defined(__LZO_i386)
147# if !defined(LZO_UNALIGNED_OK_2)
148# define LZO_UNALIGNED_OK_2
149# endif
150# if !defined(LZO_UNALIGNED_OK_4)
151# define LZO_UNALIGNED_OK_4
152# endif
153#endif
154
155
156#if defined(LZO_UNALIGNED_OK_2) || defined(LZO_UNALIGNED_OK_4)
157# if !defined(LZO_UNALIGNED_OK)
158# define LZO_UNALIGNED_OK
159# endif
160#endif
161
162
163/* Definitions for byte order, according to significance of bytes, from low
164 * addresses to high addresses. The value is what you get by putting '4'
165 * in the most significant byte, '3' in the second most significant byte,
166 * '2' in the second least significant byte, and '1' in the least
167 * significant byte.
168 */
169
170#define LZO_LITTLE_ENDIAN 1234
171#define LZO_BIG_ENDIAN 4321
172#define LZO_PDP_ENDIAN 3412
173
174/* The byte order is only needed if we use LZO_UNALIGNED_OK */
175#if !defined(LZO_BYTE_ORDER)
176# if defined(__LZO_i386)
177# define LZO_BYTE_ORDER LZO_LITTLE_ENDIAN
178# elif defined(__mc68000__)
179# define LZO_BYTE_ORDER LZO_BIG_ENDIAN
180# elif defined(__BYTE_ORDER)
181# define LZO_BYTE_ORDER __BYTE_ORDER
182# endif
183#endif
184
185#if defined(LZO_UNALIGNED_OK)
186# if !defined(LZO_BYTE_ORDER)
187# error LZO_BYTE_ORDER is not defined
188# elif (LZO_BYTE_ORDER != LZO_LITTLE_ENDIAN) && \
189 (LZO_BYTE_ORDER != LZO_BIG_ENDIAN)
190# error invalid LZO_BYTE_ORDER
191# endif
192#endif
193
194
195/***********************************************************************
196// optimization
197************************************************************************/
198
199/* gcc 2.6.3 and gcc 2.7.2 have a bug */
200#define LZO_OPTIMIZE_GNUC_i386_IS_BUGGY
201
202/* Help the optimizer with register allocation.
203 * Don't activate this macro for a fair comparision with other algorithms.
204 */
205#if 1 && defined(NDEBUG) && !defined(__BOUNDS_CHECKING_ON)
206# if defined(__GNUC__) && defined(__i386__)
207# if !defined(LZO_OPTIMIZE_GNUC_i386_IS_BUGGY)
208# define LZO_OPTIMIZE_GNUC_i386
209# endif
210# endif
211#endif
212
213
214/***********************************************************************
215//
216************************************************************************/
217
218#define LZO_BYTE(x) ((unsigned char) (x))
219
220#define LZO_MAX(a,b) ((a) >= (b) ? (a) : (b))
221#define LZO_MIN(a,b) ((a) <= (b) ? (a) : (b))
222
223#define lzo_sizeof(x) ((lzo_uint) (sizeof(x)))
224
225#define LZO_HIGH(x) ((lzo_uint) (sizeof(x)/sizeof(*(x))))
226
227/* this always fits into 16 bits */
228#define LZO_SIZE(bits) (1u << (bits))
229#define LZO_MASK(bits) (LZO_SIZE(bits) - 1)
230
231#define LZO_LSIZE(bits) (1ul << (bits))
232#define LZO_LMASK(bits) (LZO_LSIZE(bits) - 1)
233
234#define LZO_USIZE(bits) ((lzo_uint) 1 << (bits))
235#define LZO_UMASK(bits) (LZO_USIZE(bits) - 1)
236
237
238/***********************************************************************
239// ANSI C preprocessor macros
240************************************************************************/
241
242#define _LZO_STRINGIZE(x) #x
243#define _LZO_MEXPAND(x) _LZO_STRINGIZE(x)
244
245/* concatenate */
246#define _LZO_CONCAT2(a,b) a ## b
247#define _LZO_CONCAT3(a,b,c) a ## b ## c
248#define _LZO_CONCAT4(a,b,c,d) a ## b ## c ## d
249#define _LZO_CONCAT5(a,b,c,d,e) a ## b ## c ## d ## e
250
251/* expand and concatenate (by using one level of indirection) */
252#define _LZO_ECONCAT2(a,b) _LZO_CONCAT2(a,b)
253#define _LZO_ECONCAT3(a,b,c) _LZO_CONCAT3(a,b,c)
254#define _LZO_ECONCAT4(a,b,c,d) _LZO_CONCAT4(a,b,c,d)
255#define _LZO_ECONCAT5(a,b,c,d,e) _LZO_CONCAT5(a,b,c,d,e)
256
257
258/***********************************************************************
259//
260************************************************************************/
261
262/* Generate compressed data in a deterministic way.
263 * This is fully portable, and compression can be faster as well.
264 * A reason NOT to be deterministic is when the block size is
265 * very small (e.g. 8kB) or the dictionary is big, because
266 * then the initialization of the dictionary becomes a relevant
267 * magnitude for compression speed.
268 */
269#define LZO_DETERMINISTIC
270
271
272/***********************************************************************
273//
274************************************************************************/
275
276#if 0
277/* This line causes problems on some architectures */
278#define LZO_CHECK_MPOS_DET(m_pos,m_off,in,ip,max_offset) \
279 (BOUNDS_CHECKING_OFF_IN_EXPR( \
280 (m_off = ip - m_pos) > max_offset ))
281
282#else
283/* This is the safe (but slower) version */
284#define LZO_CHECK_MPOS_DET(m_pos,m_off,in,ip,max_offset) \
285 (m_pos == NULL || (m_off = ip - m_pos) > max_offset)
286#endif
287
288
289/* m_pos may point anywhere...
290 * This marco is probably a good candidate for architecture specific problems.
291 * Try casting the pointers to lzo_ptr_t before comparing them.
292 */
293#define LZO_CHECK_MPOS_NON_DET(m_pos,m_off,in,ip,max_offset) \
294 (BOUNDS_CHECKING_OFF_IN_EXPR( \
295 (m_pos < in || (m_off = ip - m_pos) <= 0 || m_off > max_offset) ))
296
297
298
299#endif /* already included */
300
301/*
302vi:ts=4
303*/
304
ptrdiff_t lzo_ptrdiff_t
Definition lzo_conf.h:115