GLM  0.9.5
type_int.hpp
1 
29 #ifndef glm_core_type_int
30 #define glm_core_type_int
31 
32 #include "setup.hpp"
33 
34 #if GLM_HAS_EXTENDED_INTEGER_TYPE
35 # include <cstdint>
36 #endif
37 
38 namespace glm{
39 namespace detail
40 {
41 # if GLM_HAS_EXTENDED_INTEGER_TYPE
42  typedef std::int8_t int8;
43  typedef std::int16_t int16;
44  typedef std::int32_t int32;
45  typedef std::int64_t int64;
46 
47  typedef std::uint8_t uint8;
48  typedef std::uint16_t uint16;
49  typedef std::uint32_t uint32;
50  typedef std::uint64_t uint64;
51 # else
52 # if(defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) // C99 detected, 64 bit types available
53  typedef int64_t sint64;
54  typedef uint64_t uint64;
55 # elif(GLM_COMPILER & GLM_COMPILER_VC)
56  typedef signed __int64 sint64;
57  typedef unsigned __int64 uint64;
58 # elif(GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_LLVM_GCC | GLM_COMPILER_CLANG))
59  __extension__ typedef signed long long sint64;
60  __extension__ typedef unsigned long long uint64;
61 # elif(GLM_COMPILER & GLM_COMPILER_BC)
62  typedef Int64 sint64;
63  typedef Uint64 uint64;
64 # else//unknown compiler
65  typedef signed long long sint64;
66  typedef unsigned long long uint64;
67 # endif//GLM_COMPILER
68 
69  typedef signed char int8;
70  typedef signed short int16;
71  typedef signed int int32;
72  typedef sint64 int64;
73 
74  typedef unsigned char uint8;
75  typedef unsigned short uint16;
76  typedef unsigned int uint32;
77  typedef uint64 uint64;
78 #endif//
79 
80  typedef signed int lowp_int_t;
81  typedef signed int mediump_int_t;
82  typedef signed int highp_int_t;
83 
84  typedef unsigned int lowp_uint_t;
85  typedef unsigned int mediump_uint_t;
86  typedef unsigned int highp_uint_t;
87 }//namespace detail
88 
89  typedef detail::int8 int8;
90  typedef detail::int16 int16;
91  typedef detail::int32 int32;
92  typedef detail::int64 int64;
93 
94  typedef detail::uint8 uint8;
95  typedef detail::uint16 uint16;
96  typedef detail::uint32 uint32;
97  typedef detail::uint64 uint64;
98 
101 
107  typedef detail::lowp_int_t lowp_int;
108 
114  typedef detail::mediump_int_t mediump_int;
115 
121  typedef detail::highp_int_t highp_int;
122 
128  typedef detail::lowp_uint_t lowp_uint;
129 
135  typedef detail::mediump_uint_t mediump_uint;
136 
142  typedef detail::highp_uint_t highp_uint;
143 
144 #if(!defined(GLM_PRECISION_HIGHP_INT) && !defined(GLM_PRECISION_MEDIUMP_INT) && !defined(GLM_PRECISION_LOWP_INT))
145  typedef mediump_int int_t;
146 #elif(defined(GLM_PRECISION_HIGHP_INT) && !defined(GLM_PRECISION_MEDIUMP_INT) && !defined(GLM_PRECISION_LOWP_INT))
147  typedef highp_int int_t;
148 #elif(!defined(GLM_PRECISION_HIGHP_INT) && defined(GLM_PRECISION_MEDIUMP_INT) && !defined(GLM_PRECISION_LOWP_INT))
149  typedef mediump_int int_t;
150 #elif(!defined(GLM_PRECISION_HIGHP_INT) && !defined(GLM_PRECISION_MEDIUMP_INT) && defined(GLM_PRECISION_LOWP_INT))
151  typedef lowp_int int_t;
152 #else
153 # error "GLM error: multiple default precision requested for signed interger types"
154 #endif
155 
156 #if(!defined(GLM_PRECISION_HIGHP_UINT) && !defined(GLM_PRECISION_MEDIUMP_UINT) && !defined(GLM_PRECISION_LOWP_UINT))
157  typedef mediump_uint uint_t;
158 #elif(defined(GLM_PRECISION_HIGHP_UINT) && !defined(GLM_PRECISION_MEDIUMP_UINT) && !defined(GLM_PRECISION_LOWP_UINT))
159  typedef highp_uint uint_t;
160 #elif(!defined(GLM_PRECISION_HIGHP_UINT) && defined(GLM_PRECISION_MEDIUMP_UINT) && !defined(GLM_PRECISION_LOWP_UINT))
161  typedef mediump_uint uint_t;
162 #elif(!defined(GLM_PRECISION_HIGHP_UINT) && !defined(GLM_PRECISION_MEDIUMP_UINT) && defined(GLM_PRECISION_LOWP_UINT))
163  typedef lowp_uint uint_t;
164 #else
165 # error "GLM error: multiple default precision requested for unsigned interger types"
166 #endif
167 
171  typedef unsigned int uint;
172 
174 
176 // check type sizes
177 #ifndef GLM_STATIC_ASSERT_NULL
178  GLM_STATIC_ASSERT(sizeof(glm::int8) == 1, "int8 size isn't 1 byte on this platform");
179  GLM_STATIC_ASSERT(sizeof(glm::int16) == 2, "int16 size isn't 2 bytes on this platform");
180  GLM_STATIC_ASSERT(sizeof(glm::int32) == 4, "int32 size isn't 4 bytes on this platform");
181  GLM_STATIC_ASSERT(sizeof(glm::int64) == 8, "int64 size isn't 8 bytes on this platform");
182 
183  GLM_STATIC_ASSERT(sizeof(glm::uint8) == 1, "uint8 size isn't 1 byte on this platform");
184  GLM_STATIC_ASSERT(sizeof(glm::uint16) == 2, "uint16 size isn't 2 bytes on this platform");
185  GLM_STATIC_ASSERT(sizeof(glm::uint32) == 4, "uint32 size isn't 4 bytes on this platform");
186  GLM_STATIC_ASSERT(sizeof(glm::uint64) == 8, "uint64 size isn't 8 bytes on this platform");
187 #endif//GLM_STATIC_ASSERT_NULL
188 
189 }//namespace glm
190 
191 #endif//glm_core_type_int
detail::highp_int_t highp_int
High precision signed integer.
Definition: type_int.hpp:121
detail::int8 int8
8 bit signed integer type.
Definition: type_int.hpp:89
detail::uint32 uint32
32 bit unsigned integer type.
Definition: type_int.hpp:96
detail::int16 int16
16 bit signed integer type.
Definition: type_int.hpp:90
detail::uint8 uint8_t
8 bit unsigned integer type.
Definition: fwd.hpp:895
detail::int64 int64_t
64 bit signed integer type.
Definition: fwd.hpp:305
detail::uint32 uint32_t
32 bit unsigned integer type.
Definition: fwd.hpp:903
detail::int64 int64
64 bit signed integer type.
Definition: type_int.hpp:92
unsigned int uint
Unsigned integer type.
Definition: type_int.hpp:171
detail::uint64 uint64_t
64 bit unsigned integer type.
Definition: fwd.hpp:907
detail::int16 int16_t
16 bit signed integer type.
Definition: fwd.hpp:297
detail::uint64 uint64
64 bit unsigned integer type.
Definition: type_int.hpp:97
detail::lowp_uint_t lowp_uint
Low precision unsigned integer.
Definition: type_int.hpp:128
detail::int8 int8_t
8 bit signed integer type.
Definition: fwd.hpp:293
detail::uint16 uint16_t
16 bit unsigned integer type.
Definition: fwd.hpp:899
detail::int32 int32
32 bit signed integer type.
Definition: type_int.hpp:91
detail::int32 int32_t
32 bit signed integer type.
Definition: fwd.hpp:301
detail::mediump_uint_t mediump_uint
Medium precision unsigned integer.
Definition: type_int.hpp:135
detail::uint8 uint8
8 bit unsigned integer type.
Definition: type_int.hpp:94
detail::mediump_int_t mediump_int
Medium precision signed integer.
Definition: type_int.hpp:114
detail::highp_uint_t highp_uint
High precision unsigned integer.
Definition: type_int.hpp:142
detail::lowp_int_t lowp_int
Low precision signed integer.
Definition: type_int.hpp:107
detail::uint16 uint16
16 bit unsigned integer type.
Definition: type_int.hpp:95