2 * Copyright (C) 2000, Matias Atria
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 * The purpose of this file is to define symbols that describe the
23 * system-dependent features we use. Namely, byte order, native integer
24 * types of various sizes, and safe pointer<->integer conversion.
29 #ifdef WORDS_BIGENDIAN
30 #define WORD_BIG_ENDIAN 1
32 #define WORD_LITTLE_ENDIAN 1
35 typedef unsigned long Ulong;
36 typedef unsigned int Uint;
37 typedef unsigned short Ushort;
38 typedef unsigned char Uchar;
41 typedef unsigned char Uint8;
44 /* define a datatype for 32bit integers (either int or long) */
46 typedef unsigned long Uint32;
48 #else /* SIZEOF_LONG != 4 */
50 typedef unsigned int Uint32;
52 #else /* SIZEOF_INT != 4 */
54 #include "No.appropriate.32bit.native.type.found.Fix.sysdeps.h"
56 #error No appropriate 32bit native type found. Fix sysdeps.h
57 #endif /* ! __cplusplus */
58 #endif /* SIZEOF_INT != 4 */
59 #endif /* SIZEOF_LONG != 4 */
61 /* now 16bit integers (one of long, int or short) */
63 typedef unsigned short Uint16;
65 #else /* SIZEOF_SHORT != 2 */
67 typedef unsigned int Uint16;
69 #else /* SIZEOF_INT != 2 */
71 #include "No.appropriate.16bit.native.type.found.Fix.sysdeps.h"
73 #error No appropriate 16bit native type found. Fix sysdeps.h
74 #endif /* ! __cplusplus */
75 #endif /* SIZEOF_INT != 2 */
76 #endif /* SIZEOF_SHORT != 2 */
79 * An integer type to convert to and from pointers safely. All we do here is
80 * look for an integer type with the same size as a pointer.
82 #if SIZEOF_LONG == SIZEOF_VOID_P
83 typedef unsigned long UINT;
86 #if SIZEOF_INT == SIZEOF_VOID_P
87 typedef unsigned int UINT;
90 #if SIZEOF_SHORT == SIZEOF_VOID_P
91 typedef unsigned short UINT;
95 #include "No.native.pointer-compatible.integer.type.found.Fix.sysdeps.h"
97 #error No native pointer-compatible integer type found. Fix sysdeps.h
104 typedef void *Pointer;
106 /* macros to do the safe pointer <-> integer conversions */
107 #define Ptr2Int(x) ((INT)((Pointer)(x)))
108 #define Int2Ptr(x) ((Pointer)((INT)(x)))
111 #define __PROTO(x) ()
116 #endif /* _SYSDEP_H */