0.9.6: type_int.hpp Source File

| 0.9.6

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