0.9.9 API documenation

- Main Page
- Modules
- Files

- File List

type_int.hpp
Go to the documentation of this file.
1
4 #pragma once
5
6 #include "setup.hpp"
7 #if GLM_HAS_MAKE_SIGNED
8 # include <type_traits>
9 #endif
10
11 #if GLM_HAS_EXTENDED_INTEGER_TYPE
12 # include <cstdint>
13 #endif
14
15 namespace glm{
16 namespace detail
17 {
18 # if GLM_HAS_EXTENDED_INTEGER_TYPE
19 typedef std::int8_t int8;
20 typedef std::int16_t int16;
21 typedef std::int32_t int32;
22 typedef std::int64_t int64;
23
24 typedef std::uint8_t uint8;
25 typedef std::uint16_t uint16;
26 typedef std::uint32_t uint32;
27 typedef std::uint64_t uint64;
28 # else
29 # if(defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) // C99 detected, 64 bit types available
30 typedef int64_t sint64;
31 typedef uint64_t uint64;
32
33 # elif GLM_COMPILER & GLM_COMPILER_VC
34 typedef signed __int64 sint64;
35 typedef unsigned __int64 uint64;
36
37 # elif GLM_COMPILER & GLM_COMPILER_GCC
38 # pragma GCC diagnostic ignored "-Wlong-long"
39 __extension__ typedef signed long long sint64;
40 __extension__ typedef unsigned long long uint64;
41
42 # elif (GLM_COMPILER & GLM_COMPILER_CLANG)
43 # pragma clang diagnostic ignored "-Wc++11-long-long"
44 typedef signed long long sint64;
45 typedef unsigned long long uint64;
46
47 # else//unknown compiler
48 typedef signed long long sint64;
49 typedef unsigned long long uint64;
50 # endif//GLM_COMPILER
51
52 typedef signed char int8;
53 typedef signed short int16;
54 typedef signed int int32;
55 typedef sint64 int64;
56
57 typedef unsigned char uint8;
58 typedef unsigned short uint16;
59 typedef unsigned int uint32;
60 typedef uint64 uint64;
61 #endif//
62
63 typedef signed int lowp_int_t;
64 typedef signed int mediump_int_t;
65 typedef signed int highp_int_t;
66
67 typedef unsigned int lowp_uint_t;
68 typedef unsigned int mediump_uint_t;
69 typedef unsigned int highp_uint_t;
70
71 # if GLM_HAS_MAKE_SIGNED
72 using std::make_signed;
73 using std::make_unsigned;
74
75 # else//GLM_HAS_MAKE_SIGNED
76 template<typename genType>
77 struct make_signed
78 {};
79
80 template<>
81 struct make_signed<char>
82 {
83 typedef char type;
84 };
85
86 template<>
87 struct make_signed<short>
88 {
89 typedef short type;
90 };
91
92 template<>
93 struct make_signed<int>
94 {
95 typedef int type;
96 };
97
98 template<>
99 struct make_signed<long>
100 {
101 typedef long type;
102 };
103
104 template<>
105 struct make_signed<unsigned char>
106 {
107 typedef char type;
108 };
109
110 template<>
111 struct make_signed<unsigned short>
112 {
113 typedef short type;
114 };
115
116 template<>
117 struct make_signed<unsigned int>
118 {
119 typedef int type;
120 };
121
122 template<>
123 struct make_signed<unsigned long>
124 {
125 typedef long type;
126 };
127
128 template<typename genType>
129 struct make_unsigned
130 {};
131
132 template<>
133 struct make_unsigned<char>
134 {
135 typedef unsigned char type;
136 };
137
138 template<>
139 struct make_unsigned<short>
140 {
141 typedef unsigned short type;
142 };
143
144 template<>
145 struct make_unsigned<int>
146 {
147 typedef unsigned int type;
148 };
149
150 template<>
151 struct make_unsigned<long>
152 {
153 typedef unsigned long type;
154 };
155
156 template<>
157 struct make_unsigned<unsigned char>
158 {
159 typedef unsigned char type;
160 };
161
162 template<>
163 struct make_unsigned<unsigned short>
164 {
165 typedef unsigned short type;
166 };
167
168 template<>
169 struct make_unsigned<unsigned int>
170 {
171 typedef unsigned int type;
172 };
173
174 template<>
175 struct make_unsigned<unsigned long>
176 {
177 typedef unsigned long type;
178 };
179
180 template<>
181 struct make_signed<long long>
182 {
183 typedef long long type;
184 };
185
186 template<>
187 struct make_signed<unsigned long long>
188 {
189 typedef long long type;
190 };
191
192 template<>
193 struct make_unsigned<long long>
194 {
195 typedef unsigned long long type;
196 };
197
198 template<>
199 struct make_unsigned<unsigned long long>
200 {
201 typedef unsigned long long type;
202 };
203 # endif//GLM_HAS_MAKE_SIGNED
204 }//namespace detail
205
206 typedef detail::int8 int8;
207 typedef detail::int16 int16;
208 typedef detail::int32 int32;
209 typedef detail::int64 int64;
210
211 typedef detail::uint8 uint8;
212 typedef detail::uint16 uint16;
213 typedef detail::uint32 uint32;
214 typedef detail::uint64 uint64;
215
218
224 typedef detail::lowp_int_t lowp_int;
225
231 typedef detail::mediump_int_t mediump_int;
232
238 typedef detail::highp_int_t highp_int;
239
245 typedef detail::lowp_uint_t lowp_uint;
246
252 typedef detail::mediump_uint_t mediump_uint;
253
259 typedef detail::highp_uint_t highp_uint;
260
261 #if(!defined(GLM_PRECISION_HIGHP_INT) && !defined(GLM_PRECISION_MEDIUMP_INT) && !defined(GLM_PRECISION_LOWP_INT))
262 typedef mediump_int int_t;
263 #elif(defined(GLM_PRECISION_HIGHP_INT) && !defined(GLM_PRECISION_MEDIUMP_INT) && !defined(GLM_PRECISION_LOWP_INT))
264 typedef highp_int int_t;
265 #elif(!defined(GLM_PRECISION_HIGHP_INT) && defined(GLM_PRECISION_MEDIUMP_INT) && !defined(GLM_PRECISION_LOWP_INT))
266 typedef mediump_int int_t;
267 #elif(!defined(GLM_PRECISION_HIGHP_INT) && !defined(GLM_PRECISION_MEDIUMP_INT) && defined(GLM_PRECISION_LOWP_INT))
268 typedef lowp_int int_t;
269 #else
270 # error "GLM error: multiple default precision requested for signed integer types"
271 #endif
272
273 #if(!defined(GLM_PRECISION_HIGHP_UINT) && !defined(GLM_PRECISION_MEDIUMP_UINT) && !defined(GLM_PRECISION_LOWP_UINT))
274 typedef mediump_uint uint_t;
275 #elif(defined(GLM_PRECISION_HIGHP_UINT) && !defined(GLM_PRECISION_MEDIUMP_UINT) && !defined(GLM_PRECISION_LOWP_UINT))
276 typedef highp_uint uint_t;
277 #elif(!defined(GLM_PRECISION_HIGHP_UINT) && defined(GLM_PRECISION_MEDIUMP_UINT) && !defined(GLM_PRECISION_LOWP_UINT))
278 typedef mediump_uint uint_t;
279 #elif(!defined(GLM_PRECISION_HIGHP_UINT) && !defined(GLM_PRECISION_MEDIUMP_UINT) && defined(GLM_PRECISION_LOWP_UINT))
280 typedef lowp_uint uint_t;
281 #else
282 # error "GLM error: multiple default precision requested for unsigned integer types"
283 #endif
284
288 typedef unsigned int uint;
289
291
293 // check type sizes
294 #ifndef GLM_STATIC_ASSERT_NULL
295 GLM_STATIC_ASSERT(sizeof(glm::int8) == 1, "int8 size isn't 1 byte on this platform");
296 GLM_STATIC_ASSERT(sizeof(glm::int16) == 2, "int16 size isn't 2 bytes on this platform");
297 GLM_STATIC_ASSERT(sizeof(glm::int32) == 4, "int32 size isn't 4 bytes on this platform");
298 GLM_STATIC_ASSERT(sizeof(glm::int64) == 8, "int64 size isn't 8 bytes on this platform");
299
300 GLM_STATIC_ASSERT(sizeof(glm::uint8) == 1, "uint8 size isn't 1 byte on this platform");
301 GLM_STATIC_ASSERT(sizeof(glm::uint16) == 2, "uint16 size isn't 2 bytes on this platform");
302 GLM_STATIC_ASSERT(sizeof(glm::uint32) == 4, "uint32 size isn't 4 bytes on this platform");
303 GLM_STATIC_ASSERT(sizeof(glm::uint64) == 8, "uint64 size isn't 8 bytes on this platform");
304 #endif//GLM_STATIC_ASSERT_NULL
305
306 }//namespace glm
glm::int16
detail::int16 int16
16 bit signed integer type.
Definition: type_int.hpp:207
glm::uint8_t
detail::uint8 uint8_t
8 bit unsigned integer type.
Definition: fwd.hpp:879
glm::int64_t
detail::int64 int64_t
64 bit signed integer type.
Definition: fwd.hpp:282
glm::uint64
detail::uint64 uint64
64 bit unsigned integer type.
Definition: type_int.hpp:214
glm::int64
detail::int64 int64
64 bit signed integer type.
Definition: type_int.hpp:209
glm::highp_int
detail::highp_int_t highp_int
High qualifier signed integer.
Definition: type_int.hpp:238
glm
Definition: common.hpp:20
glm::int8
detail::int8 int8
8 bit signed integer type.
Definition: type_int.hpp:206
glm::uint8
detail::uint8 uint8
8 bit unsigned integer type.
Definition: type_int.hpp:211
glm::mediump_uint
detail::mediump_uint_t mediump_uint
Medium qualifier unsigned integer.
Definition: type_int.hpp:252
glm::lowp_uint
detail::lowp_uint_t lowp_uint
Low qualifier unsigned integer.
Definition: type_int.hpp:245
glm::uint32_t
detail::uint32 uint32_t
32 bit unsigned integer type.
Definition: fwd.hpp:887
glm::int32
detail::int32 int32
32 bit signed integer type.
Definition: type_int.hpp:208
glm::uint64_t
detail::uint64 uint64_t
64 bit unsigned integer type.
Definition: fwd.hpp:891
glm::uint16_t
detail::uint16 uint16_t
16 bit unsigned integer type.
Definition: fwd.hpp:883
glm::highp_uint
detail::highp_uint_t highp_uint
High qualifier unsigned integer.
Definition: type_int.hpp:259
glm::uint16
detail::uint16 uint16
16 bit unsigned integer type.
Definition: type_int.hpp:212
glm::int16_t
detail::int16 int16_t
16 bit signed integer type.
Definition: fwd.hpp:274
setup.hpp
Core features
glm::int8_t
detail::int8 int8_t
8 bit signed integer type.
Definition: fwd.hpp:270
glm::uint32
detail::uint32 uint32
32 bit unsigned integer type.
Definition: type_int.hpp:213
glm::int32_t
detail::int32 int32_t
32 bit signed integer type.
Definition: fwd.hpp:278
glm::uint
unsigned int uint
Unsigned integer type.
Definition: type_int.hpp:288
glm::lowp_int
detail::lowp_int_t lowp_int
Low qualifier signed integer.
Definition: type_int.hpp:224
glm::mediump_int
detail::mediump_int_t mediump_int
Medium qualifier signed integer.
Definition: type_int.hpp:231