1//  qcms
2//  Copyright (C) 2009 Mozilla Foundation
3//
4// Permission is hereby granted, free of charge, to any person obtaining
5// a copy of this software and associated documentation files (the "Software"),
6// to deal in the Software without restriction, including without limitation
7// the rights to use, copy, modify, merge, publish, distribute, sublicense,
8// and/or sell copies of the Software, and to permit persons to whom the Software
9// is furnished to do so, subject to the following conditions:
10//
11// The above copyright notice and this permission notice shall be included in
12// all copies or substantial portions of the Software.
13//
14// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
16// THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22#ifndef QCMS_TYPES_H
23#define QCMS_TYPES_H
24
25#if BYTE_ORDER == LITTLE_ENDIAN
26#define IS_LITTLE_ENDIAN
27#elif BYTE_ORDER == BIG_ENDIAN
28#define IS_BIG_ENDIAN
29#endif
30
31/* all of the platforms that we use _MSC_VER on are little endian
32 * so this is sufficient for now */
33#ifdef _MSC_VER
34#define IS_LITTLE_ENDIAN
35#endif
36
37#ifdef __OS2__
38#define IS_LITTLE_ENDIAN
39#endif
40
41#if !defined(IS_LITTLE_ENDIAN) && !defined(IS_BIG_ENDIAN)
42#error Unknown endianess
43#endif
44
45#if defined (_SVR4) || defined (SVR4) || defined (__OpenBSD__) || defined (_sgi) || defined (__sun) || defined (sun) || defined (__digital__)
46#  include <inttypes.h>
47#elif defined (_MSC_VER) && _MSC_VER < 1600
48typedef __int8 int8_t;
49typedef unsigned __int8 uint8_t;
50typedef __int16 int16_t;
51typedef unsigned __int16 uint16_t;
52typedef __int32 int32_t;
53typedef unsigned __int32 uint32_t;
54typedef __int64 int64_t;
55typedef unsigned __int64 uint64_t;
56#ifdef _WIN64
57typedef unsigned __int64 uintptr_t;
58#else
59#pragma warning(push)
60/* Disable benign redefinition of type warning 4142 */
61#pragma warning(disable:4142)
62typedef unsigned long uintptr_t;
63/* Restore warnings */
64#pragma warning(pop)
65#endif
66
67#elif defined (_AIX)
68#  include <sys/inttypes.h>
69#else
70#  include <stdint.h>
71#endif
72
73typedef qcms_bool bool;
74#define true 1
75#define false 0
76
77#endif
78