0.9.7: type_int.hpp Source File

| 0.9.7

- Main Page
- Modules
- Files

- File List

type_int.hpp
Go to the documentation of this file.
1
33 #pragma once
34
35 #include "setup.hpp"
36 #if GLM_HAS_MAKE_SIGNED
37 # include <type_traits>
38 #endif
39
40 #if GLM_HAS_EXTENDED_INTEGER_TYPE
41 # include <cstdint>
42 #endif
43
44 namespace glm{
45 namespace detail
46 {
47 # if GLM_HAS_EXTENDED_INTEGER_TYPE
48 typedef std::int8_t int8;
49 typedef std::int16_t int16;
50 typedef std::int32_t int32;
51 typedef std::int64_t int64;
52
53 typedef std::uint8_t uint8;
54 typedef std::uint16_t uint16;
55 typedef std::uint32_t uint32;
56 typedef std::uint64_t uint64;
57 # else
58 # if(defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) // C99 detected, 64 bit types available
59 typedef int64_t sint64;
60 typedef uint64_t uint64;
61 # elif GLM_COMPILER & GLM_COMPILER_VC
62 typedef signed __int64 sint64;
63 typedef unsigned __int64 uint64;
64 # elif GLM_COMPILER & GLM_COMPILER_GCC
65 __extension__ typedef signed long long sint64;
66 __extension__ typedef unsigned long long uint64;
67 # else//unknown compiler
68 typedef signed long long sint64;
69 typedef unsigned long long uint64;
70 # endif//GLM_COMPILER
71
72 typedef signed char int8;
73 typedef signed short int16;
74 typedef signed int int32;
75 typedef sint64 int64;
76
77 typedef unsigned char uint8;
78 typedef unsigned short uint16;
79 typedef unsigned int uint32;
80 typedef uint64 uint64;
81 #endif//
82
83 typedef signed int lowp_int_t;
84 typedef signed int mediump_int_t;
85 typedef signed int highp_int_t;
86
87 typedef unsigned int lowp_uint_t;
88 typedef unsigned int mediump_uint_t;
89 typedef unsigned int highp_uint_t;
90
91 # if GLM_HAS_MAKE_SIGNED
92 using std::make_signed;
93 using std::make_unsigned;
94
95 # else//GLM_HAS_MAKE_SIGNED
96 template <typename genType>
97 struct make_signed
98 {};
99
100 template <>
101 struct make_signed<char>
102 {
103 typedef char type;
104 };
105
106 template <>
107 struct make_signed<short>
108 {
109 typedef short type;
110 };
111
112 template <>
113 struct make_signed<int>
114 {
115 typedef int type;
116 };
117
118 template <>
119 struct make_signed<long>
120 {
121 typedef long type;
122 };
123
124 template <>
125 struct make_signed<long long>
126 {
127 typedef long long type;
128 };
129
130 template <>
131 struct make_signed<unsigned char>
132 {
133 typedef char type;
134 };
135
136 template <>
137 struct make_signed<unsigned short>
138 {
139 typedef short type;
140 };
141
142 template <>
143 struct make_signed<unsigned int>
144 {
145 typedef int type;
146 };
147
148 template <>
149 struct make_signed<unsigned long>
150 {
151 typedef long type;
152 };
153
154 template <>
155 struct make_signed<unsigned long long>
156 {
157 typedef long long type;
158 };
159
160 template <typename genType>
161 struct make_unsigned
162 {};
163
164 template <>
165 struct make_unsigned<char>
166 {
167 typedef unsigned char type;
168 };
169
170 template <>
171 struct make_unsigned<short>
172 {
173 typedef unsigned short type;
174 };
175
176 template <>
177 struct make_unsigned<int>
178 {
179 typedef unsigned int type;
180 };
181
182 template <>
183 struct make_unsigned<long>
184 {
185 typedef unsigned long type;
186 };
187
188 template <>
189 struct make_unsigned<long long>
190 {
191 typedef unsigned long long type;
192 };
193
194 template <>
195 struct make_unsigned<unsigned char>
196 {
197 typedef unsigned char type;
198 };
199
200 template <>
201 struct make_unsigned<unsigned short>
202 {
203 typedef unsigned short type;
204 };
205
206 template <>
207 struct make_unsigned<unsigned int>
208 {
209 typedef unsigned int type;
210 };
211
212 template <>
213 struct make_unsigned<unsigned long>
214 {
215 typedef unsigned long type;
216 };
217
218 template <>
219 struct make_unsigned<unsigned long long>
220 {
221 typedef unsigned long long type;
222 };
223 # endif//GLM_HAS_MAKE_SIGNED
224 }//namespace detail
225
226 typedef detail::int8 int8;
227 typedef detail::int16 int16;
228 typedef detail::int32 int32;
229 typedef detail::int64 int64;
230
231 typedef detail::uint8 uint8;
232 typedef detail::uint16 uint16;
233 typedef detail::uint32 uint32;
234 typedef detail::uint64 uint64;
235
238
244 typedef detail::lowp_int_t lowp_int;
245
251 typedef detail::mediump_int_t mediump_int;
252
258 typedef detail::highp_int_t highp_int;
259
265 typedef detail::lowp_uint_t lowp_uint;
266
272 typedef detail::mediump_uint_t mediump_uint;
273
279 typedef detail::highp_uint_t highp_uint;
280
281 #if(!defined(GLM_PRECISION_HIGHP_INT) && !defined(GLM_PRECISION_MEDIUMP_INT) && !defined(GLM_PRECISION_LOWP_INT))
282 typedef mediump_int int_t;
283 #elif(defined(GLM_PRECISION_HIGHP_INT) && !defined(GLM_PRECISION_MEDIUMP_INT) && !defined(GLM_PRECISION_LOWP_INT))
284 typedef highp_int int_t;
285 #elif(!defined(GLM_PRECISION_HIGHP_INT) && defined(GLM_PRECISION_MEDIUMP_INT) && !defined(GLM_PRECISION_LOWP_INT))
286 typedef mediump_int int_t;
287 #elif(!defined(GLM_PRECISION_HIGHP_INT) && !defined(GLM_PRECISION_MEDIUMP_INT) && defined(GLM_PRECISION_LOWP_INT))
288 typedef lowp_int int_t;
289 #else
290 # error "GLM error: multiple default precision requested for signed interger types"
291 #endif
292
293 #if(!defined(GLM_PRECISION_HIGHP_UINT) && !defined(GLM_PRECISION_MEDIUMP_UINT) && !defined(GLM_PRECISION_LOWP_UINT))
294 typedef mediump_uint uint_t;
295 #elif(defined(GLM_PRECISION_HIGHP_UINT) && !defined(GLM_PRECISION_MEDIUMP_UINT) && !defined(GLM_PRECISION_LOWP_UINT))
296 typedef highp_uint uint_t;
297 #elif(!defined(GLM_PRECISION_HIGHP_UINT) && defined(GLM_PRECISION_MEDIUMP_UINT) && !defined(GLM_PRECISION_LOWP_UINT))
298 typedef mediump_uint uint_t;
299 #elif(!defined(GLM_PRECISION_HIGHP_UINT) && !defined(GLM_PRECISION_MEDIUMP_UINT) && defined(GLM_PRECISION_LOWP_UINT))
300 typedef lowp_uint uint_t;
301 #else
302 # error "GLM error: multiple default precision requested for unsigned interger types"
303 #endif
304
308 typedef unsigned int uint;
309
311
313 // check type sizes
314 #ifndef GLM_STATIC_ASSERT_NULL
315 GLM_STATIC_ASSERT(sizeof(glm::int8) == 1, "int8 size isn't 1 byte on this platform");
316 GLM_STATIC_ASSERT(sizeof(glm::int16) == 2, "int16 size isn't 2 bytes on this platform");
317 GLM_STATIC_ASSERT(sizeof(glm::int32) == 4, "int32 size isn't 4 bytes on this platform");
318 GLM_STATIC_ASSERT(sizeof(glm::int64) == 8, "int64 size isn't 8 bytes on this platform");
319
320 GLM_STATIC_ASSERT(sizeof(glm::uint8) == 1, "uint8 size isn't 1 byte on this platform");
321 GLM_STATIC_ASSERT(sizeof(glm::uint16) == 2, "uint16 size isn't 2 bytes on this platform");
322 GLM_STATIC_ASSERT(sizeof(glm::uint32) == 4, "uint32 size isn't 4 bytes on this platform");
323 GLM_STATIC_ASSERT(sizeof(glm::uint64) == 8, "uint64 size isn't 8 bytes on this platform");
324 #endif//GLM_STATIC_ASSERT_NULL
325
326 }//namespace glm
glm::int8_t
detail::int8 int8_t
8 bit signed integer type.
Definition: fwd.hpp:297
glm::int32_t
detail::int32 int32_t
32 bit signed integer type.
Definition: fwd.hpp:305
glm::int32
detail::int32 int32
32 bit signed integer type.
Definition: type_int.hpp:228
glm::uint8
detail::uint8 uint8
8 bit unsigned integer type.
Definition: type_int.hpp:231
glm::int8
detail::int8 int8
8 bit signed integer type.
Definition: type_int.hpp:226
glm::int16
detail::int16 int16
16 bit signed integer type.
Definition: type_int.hpp:227
glm::uint16
detail::uint16 uint16
16 bit unsigned integer type.
Definition: type_int.hpp:232
glm::uint
unsigned int uint
Unsigned integer type.
Definition: type_int.hpp:308
glm::highp_uint
detail::highp_uint_t highp_uint
High precision unsigned integer.
Definition: type_int.hpp:279
glm::uint32_t
detail::uint32 uint32_t
32 bit unsigned integer type.
Definition: fwd.hpp:914
glm::highp_int
detail::highp_int_t highp_int
High precision signed integer.
Definition: type_int.hpp:258
glm
Definition: _noise.hpp:40
setup.hpp
OpenGL Mathematics (glm.g-truc.net)
glm::mediump_int
detail::mediump_int_t mediump_int
Medium precision signed integer.
Definition: type_int.hpp:251
glm::lowp_uint
detail::lowp_uint_t lowp_uint
Low precision unsigned integer.
Definition: type_int.hpp:265
glm::lowp_int
detail::lowp_int_t lowp_int
Low precision signed integer.
Definition: type_int.hpp:244
glm::mediump_uint
detail::mediump_uint_t mediump_uint
Medium precision unsigned integer.
Definition: type_int.hpp:272
glm::uint32
detail::uint32 uint32
32 bit unsigned integer type.
Definition: type_int.hpp:233
glm::uint8_t
detail::uint8 uint8_t
8 bit unsigned integer type.
Definition: fwd.hpp:906
glm::int64_t
detail::int64 int64_t
64 bit signed integer type.
Definition: fwd.hpp:309
glm::uint64
detail::uint64 uint64
64 bit unsigned integer type.
Definition: type_int.hpp:234
glm::int64
detail::int64 int64
64 bit signed integer type.
Definition: type_int.hpp:229
glm::uint16_t
detail::uint16 uint16_t
16 bit unsigned integer type.
Definition: fwd.hpp:910
glm::uint64_t
detail::uint64 uint64_t
64 bit unsigned integer type.
Definition: fwd.hpp:918
glm::int16_t
detail::int16 int16_t
16 bit signed integer type.
Definition: fwd.hpp:301