ChampSim
magick_types.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2003 - 2012 GraphicsMagick Group
3 
4  This program is covered by multiple licenses, which are described in
5  Copyright.txt. You should have received a copy of Copyright.txt with this
6  package; otherwise see http://www.graphicsmagick.org/www/Copyright.html.
7 
8  GraphicsMagick types typedefs.
9 
10  GraphicsMagick is expected to compile with any C '89 ANSI C compiler
11  supporting at least 16-bit 'short', 32-bit 'int', and 32-bit 'long'.
12  It is also expected to take advantage of 64-bit LP64 and Windows
13  WIN64 LLP64. We use C '99 style types but declare our own types so
14  as to not depend on C '99 header files, and take care to depend only
15  on C '89 library functions, POSIX, or well-known extensions. Any C
16  '99 syntax used is removed if the compiler does not support it.
17 */
18 
19 #ifndef _MAGICK_TYPES_H
20 #define _MAGICK_TYPES_H
21 
22 #if defined(__cplusplus) || defined(c_plusplus)
23 extern "C" {
24 #endif
25 
26 /*
27  Assign ANSI C stdint.h-like typedefs based on the sizes of native types
28  magick_int8_t -- -128 to 127
29  magick_uint8_t -- 0 to 255
30  magick_int16_t -- -32,768 to 32,767
31  magick_uint16_t -- 0 to 65,535
32  magick_int32_t -- -2,147,483,648 to 2,147,483,647
33  magick_uint32_t -- 0 to 4,294,967,295
34  magick_int64_t -- -9,223,372,036,854,775,807 to 9,223,372,036,854,775,807
35  magick_uint64_t -- 0 to 18,446,744,073,709,551,615
36 
37  magick_uintmax_t -- largest native unsigned integer type ("%ju")
38  0 to UINTMAX_MAX
39  UINTMAX_C(value) declares constant value
40  magick_uintptr_t -- unsigned type for storing a pointer value ("%tu")
41  0 to UINTPTR_MAX
42 
43  ANSI C '99 stddef.h-like types
44  size_t -- unsigned type representing sizes of objects ("%zu")
45  0 to SIZE_MAX
46  magick_ptrdiff_t -- signed type for subtracting two pointers ("%td")
47  PTRDIFF_MIN to PTRDIFF_MAX
48 
49  EEE Std 1003.1, 2004 types
50  ssize_t -- signed type for a count of bytes or an error indication ("%zd")
51  ? to SSIZE_MAX
52 */
53 
54 #if (defined(WIN32) || defined(WIN64)) && \
55  !defined(__MINGW32__) && !defined(__MINGW64__)
56 
57  /* The following typedefs are used for WIN32 & WIN64 (without
58  configure) */
59  typedef signed char magick_int8_t;
60  typedef unsigned char magick_uint8_t;
61 
62  typedef signed short magick_int16_t;
63  typedef unsigned short magick_uint16_t;
64 
65  typedef signed int magick_int32_t;
66 # define MAGICK_INT32_F ""
67  typedef unsigned int magick_uint32_t;
68 # define MAGICK_UINT32_F ""
69 
70  typedef signed __int64 magick_int64_t;
71 # define MAGICK_INT64_F "I64"
72  typedef unsigned __int64 magick_uint64_t;
73 # define MAGICK_UINT64_F "I64"
74 
76 
77 # if defined(WIN32)
78  typedef unsigned long magick_uintptr_t;
79 # define MAGICK_SIZE_T_F "l"
80 # define MAGICK_SIZE_T unsigned long
81 # define MAGICK_SSIZE_T_F "l"
82 # define MAGICK_SSIZE_T long
83 # elif defined(WIN64)
84  /* WIN64 uses the LLP64 model */
85  typedef unsigned long long magick_uintptr_t;
86 # define MAGICK_SIZE_T_F "I64"
87 # define MAGICK_SIZE_T unsigned __int64
88 # define MAGICK_SSIZE_T_F "I64"
89 # define MAGICK_SSIZE_T signed __int64
90 # endif
91 
92 #else
93 
94  /* The following typedefs are subtituted when using Unixish configure */
95  typedef signed char magick_int8_t;
96  typedef unsigned char magick_uint8_t;
97 
98  typedef signed short magick_int16_t;
99  typedef unsigned short magick_uint16_t;
100 
101  typedef signed int magick_int32_t;
102 # define MAGICK_INT32_F ""
103  typedef unsigned int magick_uint32_t;
104 # define MAGICK_UINT32_F ""
105 
106  typedef signed long magick_int64_t;
107 # define MAGICK_INT64_F "l"
108  typedef unsigned long magick_uint64_t;
109 # define MAGICK_UINT64_F "l"
110 
111  typedef unsigned long magick_uintmax_t;
112 # define MAGICK_UINTMAX_F "l"
113 
114  typedef unsigned long magick_uintptr_t;
115 # define MAGICK_UINTPTR_F "l"
116 
117 # define MAGICK_SIZE_T_F "l"
118 # define MAGICK_SIZE_T unsigned long
119 
120 # define MAGICK_SSIZE_T_F "l"
121 # define MAGICK_SSIZE_T signed long
122 
123 #endif
124 
125  /* 64-bit file and blob offset type */
127 #define MAGICK_OFF_F MAGICK_INT64_F
128 
129 #if defined(__cplusplus) || defined(c_plusplus)
130 }
131 #endif /* defined(__cplusplus) || defined(c_plusplus) */
132 
133 #endif /* _MAGICK_TYPES_H */
unsigned short magick_uint16_t
Definition: magick_types.h:99
unsigned int magick_uint32_t
Definition: magick_types.h:103
signed short magick_int16_t
Definition: magick_types.h:98
unsigned long magick_uint64_t
Definition: magick_types.h:108
unsigned char magick_uint8_t
Definition: magick_types.h:96
signed char magick_int8_t
Definition: magick_types.h:95
signed long magick_int64_t
Definition: magick_types.h:106
magick_int64_t magick_off_t
Definition: magick_types.h:126
unsigned long magick_uintmax_t
Definition: magick_types.h:111
signed int magick_int32_t
Definition: magick_types.h:101
unsigned long magick_uintptr_t
Definition: magick_types.h:114