Build system improvements
[ustl.git] / utypes.h
blobadb00cb1bff2e6065efc8502cd44c3aa566d5a32
1 // This file is part of the ustl library, an STL implementation.
2 //
3 // Copyright (C) 2005 by Mike Sharov <msharov@users.sourceforge.net>
4 // This file is free software, distributed under the MIT License.
5 //
6 // utypes.h
7 //
8 // Types used by this library.
9 //
11 #ifndef UTYPES_H_118BBB3B50B7DBF22F5460C52E515C83
12 #define UTYPES_H_118BBB3B50B7DBF22F5460C52E515C83
14 #include "config.h"
15 #ifndef STDC_HEADERS
16 #error This library requires standard C and C++ headers to compile.
17 #endif
18 #ifndef STDUNIX_HEADERS
19 #error This library compiles only on UNIX systems.
20 #endif
21 #define __STDC_LIMIT_MACROS // For WCHAR_MIN and WCHAR_MAX in stdint.
22 #define __STDC_CONSTANT_MACROS // For UINT??_C macros to avoid using L and UL suffixes on constants.
23 #ifdef HAVE_STDINT_H
24 #include <stdint.h>
25 #elif HAVE_INTTYPES_H
26 #include <inttypes.h>
27 #else
28 #error Need standard integer types definitions, usually in stdint.h
29 #endif
30 #include <stddef.h> // For ptrdiff_t, size_t
31 #include <limits.h>
32 #include <float.h>
33 #ifdef HAVE_SYS_TYPES_H
34 #include <sys/types.h>
35 #endif
36 #ifndef SIZE_MAX
37 #define SIZE_MAX UINT_MAX
38 #endif
39 #if sun || __sun // Solaris defines UINTPTR_MAX as empty.
40 #undef UINTPTR_MAX
41 #define UINTPTR_MAX ULONG_MAX
42 #endif
43 #ifndef WCHAR_MAX
44 #ifdef __WCHAR_MAX__
45 #define WCHAR_MAX __WCHAR_MAX__
46 #else
47 #define WCHAR_MAX CHAR_MAX
48 #endif
49 #endif
50 #ifdef HAVE_LONG_LONG
51 #ifndef LLONG_MAX
52 #define ULLONG_MAX UINT64_C(0xFFFFFFFFFFFFFFFF)
53 #define LLONG_MAX INT64_C(0x7FFFFFFFFFFFFFFF)
54 #define LLONG_MIN ULLONG_MAX
55 #endif
56 #endif
57 #ifndef BYTE_ORDER
58 #define LITTLE_ENDIAN USTL_LITTLE_ENDIAN
59 #define BIG_ENDIAN USTL_BIG_ENDIAN
60 #define BYTE_ORDER USTL_BYTE_ORDER
61 #endif
63 typedef size_t uoff_t; ///< A type for storing offsets into blocks measured by size_t.
64 typedef uint32_t hashvalue_t; ///< Value type returned by the hash functions.
66 #endif