00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 00014 00015 00016 00017 00018 00019 00020 00021 00022 00023 00024 00025 00026 00027 00028 00029 #pragma once 00030 00031 #include "setup.hpp" 00032 00033 #if GLM_HAS_EXTENDED_INTEGER_TYPE 00034 # include <cstdint> 00035 #endif 00036 00037 namespace glm{ 00038 namespace detail 00039 { 00040 # if GLM_HAS_EXTENDED_INTEGER_TYPE 00041 typedef std::int8_t int8; 00042 typedef std::int16_t int16; 00043 typedef std::int32_t int32; 00044 typedef std::int64_t int64; 00045 00046 typedef std::uint8_t uint8; 00047 typedef std::uint16_t uint16; 00048 typedef std::uint32_t uint32; 00049 typedef std::uint64_t uint64; 00050 # else 00051 # if(defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) // C99 detected, 64 bit types available 00052 typedef int64_t sint64; 00053 typedef uint64_t uint64; 00054 # elif(GLM_COMPILER & GLM_COMPILER_VC) 00055 typedef signed __int64 sint64; 00056 typedef unsigned __int64 uint64; 00057 # elif(GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_LLVM_GCC | GLM_COMPILER_CLANG)) 00058 __extension__ typedef signed long long sint64; 00059 __extension__ typedef unsigned long long uint64; 00060 # elif(GLM_COMPILER & GLM_COMPILER_BC) 00061 typedef Int64 sint64; 00062 typedef Uint64 uint64; 00063 # else//unknown compiler 00064 typedef signed long long sint64; 00065 typedef unsigned long long uint64; 00066 # endif//GLM_COMPILER 00067 00068 typedef signed char int8; 00069 typedef signed short int16; 00070 typedef signed int int32; 00071 typedef sint64 int64; 00072 00073 typedef unsigned char uint8; 00074 typedef unsigned short uint16; 00075 typedef unsigned int uint32; 00076 typedef uint64 uint64; 00077 #endif// 00078 00079 typedef signed int lowp_int_t; 00080 typedef signed int mediump_int_t; 00081 typedef signed int highp_int_t; 00082 00083 typedef unsigned int lowp_uint_t; 00084 typedef unsigned int mediump_uint_t; 00085 typedef unsigned int highp_uint_t; 00086 }//namespace detail 00087 00088 typedef detail::int8 int8; 00089 typedef detail::int16 int16; 00090 typedef detail::int32 int32; 00091 typedef detail::int64 int64; 00092 00093 typedef detail::uint8 uint8; 00094 typedef detail::uint16 uint16; 00095 typedef detail::uint32 uint32; 00096 typedef detail::uint64 uint64; 00097 00100 00106 typedef detail::lowp_int_t lowp_int; 00107 00113 typedef detail::mediump_int_t mediump_int; 00114 00120 typedef detail::highp_int_t highp_int; 00121 00127 typedef detail::lowp_uint_t lowp_uint; 00128 00134 typedef detail::mediump_uint_t mediump_uint; 00135 00141 typedef detail::highp_uint_t highp_uint; 00142 00143 #if(!defined(GLM_PRECISION_HIGHP_INT) && !defined(GLM_PRECISION_MEDIUMP_INT) && !defined(GLM_PRECISION_LOWP_INT)) 00144 typedef mediump_int int_t; 00145 #elif(defined(GLM_PRECISION_HIGHP_INT) && !defined(GLM_PRECISION_MEDIUMP_INT) && !defined(GLM_PRECISION_LOWP_INT)) 00146 typedef highp_int int_t; 00147 #elif(!defined(GLM_PRECISION_HIGHP_INT) && defined(GLM_PRECISION_MEDIUMP_INT) && !defined(GLM_PRECISION_LOWP_INT)) 00148 typedef mediump_int int_t; 00149 #elif(!defined(GLM_PRECISION_HIGHP_INT) && !defined(GLM_PRECISION_MEDIUMP_INT) && defined(GLM_PRECISION_LOWP_INT)) 00150 typedef lowp_int int_t; 00151 #else 00152 # error "GLM error: multiple default precision requested for signed interger types" 00153 #endif 00154 00155 #if(!defined(GLM_PRECISION_HIGHP_UINT) && !defined(GLM_PRECISION_MEDIUMP_UINT) && !defined(GLM_PRECISION_LOWP_UINT)) 00156 typedef mediump_uint uint_t; 00157 #elif(defined(GLM_PRECISION_HIGHP_UINT) && !defined(GLM_PRECISION_MEDIUMP_UINT) && !defined(GLM_PRECISION_LOWP_UINT)) 00158 typedef highp_uint uint_t; 00159 #elif(!defined(GLM_PRECISION_HIGHP_UINT) && defined(GLM_PRECISION_MEDIUMP_UINT) && !defined(GLM_PRECISION_LOWP_UINT)) 00160 typedef mediump_uint uint_t; 00161 #elif(!defined(GLM_PRECISION_HIGHP_UINT) && !defined(GLM_PRECISION_MEDIUMP_UINT) && defined(GLM_PRECISION_LOWP_UINT)) 00162 typedef lowp_uint uint_t; 00163 #else 00164 # error "GLM error: multiple default precision requested for unsigned interger types" 00165 #endif 00166 00170 typedef unsigned int uint; 00171 00173 00175 // check type sizes 00176 #ifndef GLM_STATIC_ASSERT_NULL 00177 GLM_STATIC_ASSERT(sizeof(glm::int8) == 1, "int8 size isn't 1 byte on this platform"); 00178 GLM_STATIC_ASSERT(sizeof(glm::int16) == 2, "int16 size isn't 2 bytes on this platform"); 00179 GLM_STATIC_ASSERT(sizeof(glm::int32) == 4, "int32 size isn't 4 bytes on this platform"); 00180 GLM_STATIC_ASSERT(sizeof(glm::int64) == 8, "int64 size isn't 8 bytes on this platform"); 00181 00182 GLM_STATIC_ASSERT(sizeof(glm::uint8) == 1, "uint8 size isn't 1 byte on this platform"); 00183 GLM_STATIC_ASSERT(sizeof(glm::uint16) == 2, "uint16 size isn't 2 bytes on this platform"); 00184 GLM_STATIC_ASSERT(sizeof(glm::uint32) == 4, "uint32 size isn't 4 bytes on this platform"); 00185 GLM_STATIC_ASSERT(sizeof(glm::uint64) == 8, "uint64 size isn't 8 bytes on this platform"); 00186 #endif//GLM_STATIC_ASSERT_NULL 00187 00188 }//namespace glm