parent
2a20695ce5
commit
a21401d2a4
57 changed files with 785 additions and 612 deletions
@ -1,298 +0,0 @@ |
||||
/// @ref core
|
||||
/// @file glm/detail/type_int.hpp
|
||||
|
||||
#pragma once |
||||
|
||||
#include "setup.hpp" |
||||
#if GLM_HAS_MAKE_SIGNED |
||||
# include <type_traits> |
||||
#endif |
||||
|
||||
#if GLM_HAS_EXTENDED_INTEGER_TYPE |
||||
# include <cstdint> |
||||
#endif |
||||
|
||||
namespace glm{ |
||||
namespace detail |
||||
{ |
||||
# if GLM_HAS_EXTENDED_INTEGER_TYPE |
||||
typedef std::int8_t int8; |
||||
typedef std::int16_t int16; |
||||
typedef std::int32_t int32; |
||||
typedef std::int64_t int64; |
||||
|
||||
typedef std::uint8_t uint8; |
||||
typedef std::uint16_t uint16; |
||||
typedef std::uint32_t uint32; |
||||
typedef std::uint64_t uint64; |
||||
# else |
||||
# if(defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) // C99 detected, 64 bit types available
|
||||
typedef int64_t sint64; |
||||
typedef uint64_t uint64; |
||||
|
||||
# elif GLM_COMPILER & GLM_COMPILER_VC |
||||
typedef signed __int64 sint64; |
||||
typedef unsigned __int64 uint64; |
||||
|
||||
# elif GLM_COMPILER & GLM_COMPILER_GCC |
||||
# pragma GCC diagnostic ignored "-Wlong-long" |
||||
__extension__ typedef signed long long sint64; |
||||
__extension__ typedef unsigned long long uint64; |
||||
|
||||
# elif (GLM_COMPILER & GLM_COMPILER_CLANG) |
||||
# pragma clang diagnostic ignored "-Wc++11-long-long" |
||||
typedef signed long long sint64; |
||||
typedef unsigned long long uint64; |
||||
|
||||
# else//unknown compiler
|
||||
typedef signed long long sint64; |
||||
typedef unsigned long long uint64; |
||||
# endif//GLM_COMPILER
|
||||
|
||||
typedef signed char int8; |
||||
typedef signed short int16; |
||||
typedef signed int int32; |
||||
typedef sint64 int64; |
||||
|
||||
typedef unsigned char uint8; |
||||
typedef unsigned short uint16; |
||||
typedef unsigned int uint32; |
||||
typedef uint64 uint64; |
||||
#endif//
|
||||
|
||||
typedef signed int lowp_int_t; |
||||
typedef signed int mediump_int_t; |
||||
typedef signed int highp_int_t; |
||||
|
||||
typedef unsigned int lowp_uint_t; |
||||
typedef unsigned int mediump_uint_t; |
||||
typedef unsigned int highp_uint_t; |
||||
|
||||
# if GLM_HAS_MAKE_SIGNED |
||||
using std::make_signed; |
||||
using std::make_unsigned; |
||||
|
||||
# else//GLM_HAS_MAKE_SIGNED
|
||||
template<typename genType> |
||||
struct make_signed |
||||
{}; |
||||
|
||||
template<> |
||||
struct make_signed<char> |
||||
{ |
||||
typedef char type; |
||||
}; |
||||
|
||||
template<> |
||||
struct make_signed<short> |
||||
{ |
||||
typedef short type; |
||||
}; |
||||
|
||||
template<> |
||||
struct make_signed<int> |
||||
{ |
||||
typedef int type; |
||||
}; |
||||
|
||||
template<> |
||||
struct make_signed<long> |
||||
{ |
||||
typedef long type; |
||||
}; |
||||
|
||||
template<> |
||||
struct make_signed<unsigned char> |
||||
{ |
||||
typedef char type; |
||||
}; |
||||
|
||||
template<> |
||||
struct make_signed<unsigned short> |
||||
{ |
||||
typedef short type; |
||||
}; |
||||
|
||||
template<> |
||||
struct make_signed<unsigned int> |
||||
{ |
||||
typedef int type; |
||||
}; |
||||
|
||||
template<> |
||||
struct make_signed<unsigned long> |
||||
{ |
||||
typedef long type; |
||||
}; |
||||
|
||||
template<typename genType> |
||||
struct make_unsigned |
||||
{}; |
||||
|
||||
template<> |
||||
struct make_unsigned<char> |
||||
{ |
||||
typedef unsigned char type; |
||||
}; |
||||
|
||||
template<> |
||||
struct make_unsigned<short> |
||||
{ |
||||
typedef unsigned short type; |
||||
}; |
||||
|
||||
template<> |
||||
struct make_unsigned<int> |
||||
{ |
||||
typedef unsigned int type; |
||||
}; |
||||
|
||||
template<> |
||||
struct make_unsigned<long> |
||||
{ |
||||
typedef unsigned long type; |
||||
}; |
||||
|
||||
template<> |
||||
struct make_unsigned<unsigned char> |
||||
{ |
||||
typedef unsigned char type; |
||||
}; |
||||
|
||||
template<> |
||||
struct make_unsigned<unsigned short> |
||||
{ |
||||
typedef unsigned short type; |
||||
}; |
||||
|
||||
template<> |
||||
struct make_unsigned<unsigned int> |
||||
{ |
||||
typedef unsigned int type; |
||||
}; |
||||
|
||||
template<> |
||||
struct make_unsigned<unsigned long> |
||||
{ |
||||
typedef unsigned long type; |
||||
}; |
||||
|
||||
template<> |
||||
struct make_signed<long long> |
||||
{ |
||||
typedef long long type; |
||||
}; |
||||
|
||||
template<> |
||||
struct make_signed<unsigned long long> |
||||
{ |
||||
typedef long long type; |
||||
}; |
||||
|
||||
template<> |
||||
struct make_unsigned<long long> |
||||
{ |
||||
typedef unsigned long long type; |
||||
}; |
||||
|
||||
template<> |
||||
struct make_unsigned<unsigned long long> |
||||
{ |
||||
typedef unsigned long long type; |
||||
}; |
||||
# endif//GLM_HAS_MAKE_SIGNED
|
||||
}//namespace detail
|
||||
|
||||
typedef detail::int8 int8; |
||||
typedef detail::int16 int16; |
||||
typedef detail::int32 int32; |
||||
typedef detail::int64 int64; |
||||
|
||||
typedef detail::uint8 uint8; |
||||
typedef detail::uint16 uint16; |
||||
typedef detail::uint32 uint32; |
||||
typedef detail::uint64 uint64; |
||||
|
||||
/// @addtogroup core_precision
|
||||
/// @{
|
||||
|
||||
/// Low qualifier signed integer.
|
||||
/// There is no guarantee on the actual qualifier.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.3 Integers</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::lowp_int_t lowp_int; |
||||
|
||||
/// Medium qualifier signed integer.
|
||||
/// There is no guarantee on the actual qualifier.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.3 Integers</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::mediump_int_t mediump_int; |
||||
|
||||
/// High qualifier signed integer.
|
||||
/// There is no guarantee on the actual qualifier.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.3 Integers</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::highp_int_t highp_int; |
||||
|
||||
/// Low qualifier unsigned integer.
|
||||
/// There is no guarantee on the actual qualifier.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.3 Integers</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::lowp_uint_t lowp_uint; |
||||
|
||||
/// Medium qualifier unsigned integer.
|
||||
/// There is no guarantee on the actual qualifier.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.3 Integers</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::mediump_uint_t mediump_uint; |
||||
|
||||
/// High qualifier unsigned integer.
|
||||
/// There is no guarantee on the actual qualifier.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.3 Integers</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::highp_uint_t highp_uint; |
||||
|
||||
#if GLM_CONFIG_PRECISION_INT == GLM_LOWP |
||||
typedef lowp_int int_t; |
||||
#elif GLM_CONFIG_PRECISION_INT == GLM_MEDIUMP |
||||
typedef mediump_int int_t; |
||||
#else |
||||
typedef highp_int int_t; |
||||
#endif |
||||
|
||||
#if GLM_CONFIG_PRECISION_UINT == GLM_LOWP |
||||
typedef lowp_uint uint_t; |
||||
#elif GLM_CONFIG_PRECISION_UINT == GLM_MEDIUMP |
||||
typedef mediump_uint uint_t; |
||||
#else |
||||
typedef highp_uint uint_t; |
||||
#endif |
||||
|
||||
/// Unsigned integer type.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.3 Integers</a>
|
||||
typedef unsigned int uint; |
||||
|
||||
/// @}
|
||||
|
||||
////////////////////
|
||||
// check type sizes
|
||||
#ifndef GLM_STATIC_ASSERT_NULL |
||||
GLM_STATIC_ASSERT(sizeof(glm::int8) == 1, "int8 size isn't 1 byte on this platform"); |
||||
GLM_STATIC_ASSERT(sizeof(glm::int16) == 2, "int16 size isn't 2 bytes on this platform"); |
||||
GLM_STATIC_ASSERT(sizeof(glm::int32) == 4, "int32 size isn't 4 bytes on this platform"); |
||||
GLM_STATIC_ASSERT(sizeof(glm::int64) == 8, "int64 size isn't 8 bytes on this platform"); |
||||
|
||||
GLM_STATIC_ASSERT(sizeof(glm::uint8) == 1, "uint8 size isn't 1 byte on this platform"); |
||||
GLM_STATIC_ASSERT(sizeof(glm::uint16) == 2, "uint16 size isn't 2 bytes on this platform"); |
||||
GLM_STATIC_ASSERT(sizeof(glm::uint32) == 4, "uint32 size isn't 4 bytes on this platform"); |
||||
GLM_STATIC_ASSERT(sizeof(glm::uint64) == 8, "uint64 size isn't 8 bytes on this platform"); |
||||
#endif//GLM_STATIC_ASSERT_NULL
|
||||
|
||||
}//namespace glm
|
@ -0,0 +1,40 @@ |
||||
/// @ref ext_scalar_constants
|
||||
/// @file glm/ext/scalar_constants.hpp
|
||||
///
|
||||
/// @see core (dependence)
|
||||
///
|
||||
/// @defgroup ext_scalar_constants GLM_EXT_scalar_constants
|
||||
/// @ingroup ext
|
||||
///
|
||||
/// Include <glm/ext/scalar_constants.hpp> to use the features of this extension.
|
||||
///
|
||||
/// Provide a list of constants and precomputed useful values.
|
||||
|
||||
#pragma once |
||||
|
||||
// Dependencies
|
||||
#include "../detail/setup.hpp" |
||||
|
||||
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) |
||||
# pragma message("GLM: GLM_EXT_scalar_constants extension included") |
||||
#endif |
||||
|
||||
namespace glm |
||||
{ |
||||
/// @addtogroup ext_scalar_constants
|
||||
/// @{
|
||||
|
||||
/// Return the epsilon constant for floating point types.
|
||||
/// @see ext_scalar_constants
|
||||
template<typename genType> |
||||
GLM_FUNC_DECL GLM_CONSTEXPR genType epsilon(); |
||||
|
||||
/// Return the pi constant for floating point types.
|
||||
/// @see ext_scalar_constants
|
||||
template<typename genType> |
||||
GLM_FUNC_DECL GLM_CONSTEXPR genType pi(); |
||||
|
||||
/// @}
|
||||
} //namespace glm
|
||||
|
||||
#include "scalar_constants.inl" |
@ -0,0 +1,18 @@ |
||||
#include <limits> |
||||
|
||||
namespace glm |
||||
{ |
||||
template<typename genType> |
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType epsilon() |
||||
{ |
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'epsilon' only accepts floating-point inputs"); |
||||
return std::numeric_limits<genType>::epsilon(); |
||||
} |
||||
|
||||
template<typename genType> |
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType pi() |
||||
{ |
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'epsilon' only accepts floating-point inputs"); |
||||
return static_cast<genType>(3.14159265358979323846264338327950288); |
||||
} |
||||
} //namespace glm |
@ -0,0 +1,45 @@ |
||||
/// @ref ext_scalar_float_sized
|
||||
/// @file glm/ext/scalar_float_sized.hpp
|
||||
///
|
||||
/// @see core (dependence)
|
||||
///
|
||||
/// @defgroup ext_scalar_float_sized GLM_EXT_scalar_float_sized
|
||||
/// @ingroup ext
|
||||
///
|
||||
/// Include <glm/ext/scalar_float_sized.hpp> to use the features of this extension.
|
||||
///
|
||||
/// Exposes float scalar type.
|
||||
|
||||
#pragma once |
||||
|
||||
#include "../detail/setup.hpp" |
||||
|
||||
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) |
||||
# pragma message("GLM: GLM_EXT_scalar_float_sized extension included") |
||||
#endif |
||||
|
||||
namespace glm |
||||
{ |
||||
/// @addtogroup ext_scalar_float
|
||||
/// @{
|
||||
|
||||
/// Low qualifier floating-point numbers.
|
||||
/// There is no guarantee on the actual qualifier.
|
||||
///
|
||||
/// @see ext_vector_relational
|
||||
typedef float float32; |
||||
|
||||
|
||||
# ifndef GLM_FORCE_SINGLE_ONLY |
||||
|
||||
/// Low qualifier floating-point numbers.
|
||||
/// There is no guarantee on the actual qualifier.
|
||||
///
|
||||
/// @see ext_vector_relational
|
||||
typedef double float64; |
||||
|
||||
# endif//GLM_FORCE_SINGLE_ONLY
|
||||
|
||||
/// @}
|
||||
|
||||
}//namespace glm
|
@ -0,0 +1,74 @@ |
||||
/// @ref ext_scalar_int_sized
|
||||
/// @file glm/ext/scalar_int_sized.hpp
|
||||
///
|
||||
/// @see core (dependence)
|
||||
///
|
||||
/// @defgroup ext_scalar_int_sized GLM_EXT_scalar_int_sized
|
||||
/// @ingroup ext
|
||||
///
|
||||
/// Include <glm/ext/scalar_int_sized.hpp> to use the features of this extension.
|
||||
///
|
||||
/// Exposes signed integer scalar type.
|
||||
|
||||
#pragma once |
||||
|
||||
#include "../detail/setup.hpp" |
||||
|
||||
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) |
||||
# pragma message("GLM: GLM_EXT_scalar_int_sized extension included") |
||||
#endif |
||||
|
||||
namespace glm{ |
||||
namespace detail |
||||
{ |
||||
# if GLM_HAS_EXTENDED_INTEGER_TYPE |
||||
typedef std::int8_t int8; |
||||
typedef std::int16_t int16; |
||||
typedef std::int32_t int32; |
||||
# else |
||||
typedef char int8; |
||||
typedef short int16; |
||||
typedef int int32; |
||||
#endif//
|
||||
|
||||
template<> |
||||
struct is_int<int8> |
||||
{ |
||||
enum test {value = ~0}; |
||||
}; |
||||
|
||||
template<> |
||||
struct is_int<int16> |
||||
{ |
||||
enum test {value = ~0}; |
||||
}; |
||||
|
||||
template<> |
||||
struct is_int<int64> |
||||
{ |
||||
enum test {value = ~0}; |
||||
}; |
||||
}//namespace detail
|
||||
|
||||
|
||||
/// @addtogroup ext_scalar_int_sized
|
||||
/// @{
|
||||
|
||||
/// 8 bit signed integer type.
|
||||
/// @see ext_scalar_int_sized
|
||||
typedef detail::int8 int8; |
||||
|
||||
/// 16 bit signed integer type.
|
||||
/// @see ext_scalar_int_sized
|
||||
typedef detail::int16 int16; |
||||
|
||||
/// 32 bit signed integer type.
|
||||
/// @see ext_scalar_int_sized
|
||||
typedef detail::int32 int32; |
||||
|
||||
/// 64 bit signed integer type.
|
||||
/// @see ext_scalar_int_sized
|
||||
typedef detail::int64 int64; |
||||
|
||||
/// @}
|
||||
}//namespace glm
|
@ -0,0 +1,74 @@ |
||||
/// @ref ext_scalar_uint_sized
|
||||
/// @file glm/ext/scalar_uint_sized.hpp
|
||||
///
|
||||
/// @see core (dependence)
|
||||
///
|
||||
/// @defgroup ext_scalar_uint_sized GLM_EXT_scalar_uint_sized
|
||||
/// @ingroup ext
|
||||
///
|
||||
/// Include <glm/ext/scalar_uint_sized.hpp> to use the features of this extension.
|
||||
///
|
||||
/// Exposes unsigned integer scalar type.
|
||||
|
||||
#pragma once |
||||
|
||||
#include "../detail/setup.hpp" |
||||
|
||||
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) |
||||
# pragma message("GLM: GLM_EXT_scalar_uint_sized extension included") |
||||
#endif |
||||
|
||||
namespace glm{ |
||||
namespace detail |
||||
{ |
||||
# if GLM_HAS_EXTENDED_INTEGER_TYPE |
||||
typedef std::uint8_t uint8; |
||||
typedef std::uint16_t uint16; |
||||
typedef std::uint32_t uint32; |
||||
# else |
||||
typedef unsigned char uint8; |
||||
typedef unsigned short uint16; |
||||
typedef unsigned int uint32; |
||||
#endif |
||||
|
||||
template<> |
||||
struct is_int<uint8> |
||||
{ |
||||
enum test {value = ~0}; |
||||
}; |
||||
|
||||
template<> |
||||
struct is_int<uint16> |
||||
{ |
||||
enum test {value = ~0}; |
||||
}; |
||||
|
||||
template<> |
||||
struct is_int<uint64> |
||||
{ |
||||
enum test {value = ~0}; |
||||
}; |
||||
}//namespace detail
|
||||
|
||||
|
||||
/// @addtogroup ext_scalar_uint_sized
|
||||
/// @{
|
||||
|
||||
/// 8 bit unsigned integer type.
|
||||
/// @see ext_scalar_uint_sized
|
||||
typedef detail::uint8 uint8; |
||||
|
||||
/// 16 bit unsigned integer type.
|
||||
/// @see ext_scalar_uint_sized
|
||||
typedef detail::uint16 uint16; |
||||
|
||||
/// 32 bit unsigned integer type.
|
||||
/// @see ext_scalar_uint_sized
|
||||
typedef detail::uint32 uint32; |
||||
|
||||
/// 64 bit unsigned integer type.
|
||||
/// @see ext_scalar_uint_sized
|
||||
typedef detail::uint64 uint64; |
||||
|
||||
/// @}
|
||||
}//namespace glm
|
@ -1,31 +0,0 @@ |
||||
#include <glm/glm.hpp> |
||||
|
||||
int test_float_size() |
||||
{ |
||||
return |
||||
sizeof(glm::float_t) != sizeof(glm::lowp_float) && |
||||
sizeof(glm::float_t) != sizeof(glm::mediump_float) &&
|
||||
sizeof(glm::float_t) != sizeof(glm::highp_float); |
||||
} |
||||
|
||||
int test_float_precision() |
||||
{ |
||||
return ( |
||||
sizeof(glm::lowp_float) <= sizeof(glm::mediump_float) &&
|
||||
sizeof(glm::mediump_float) <= sizeof(glm::highp_float)) ? 0 : 1; |
||||
} |
||||
|
||||
int test_vec2() |
||||
{ |
||||
return 0; |
||||
} |
||||
|
||||
int main() |
||||
{ |
||||
int Error = 0; |
||||
|
||||
Error += test_float_size(); |
||||
Error += test_float_precision(); |
||||
|
||||
return Error; |
||||
} |
@ -0,0 +1,36 @@ |
||||
#include <glm/ext/scalar_constants.hpp> |
||||
|
||||
template <typename valType> |
||||
static int test_epsilon() |
||||
{ |
||||
int Error = 0; |
||||
|
||||
valType const Test = glm::epsilon<valType>(); |
||||
Error += Test > static_cast<valType>(0) ? 0 : 1; |
||||
|
||||
return Error; |
||||
} |
||||
|
||||
template <typename valType> |
||||
static int test_pi() |
||||
{ |
||||
int Error = 0; |
||||
|
||||
valType const Test = glm::pi<valType>(); |
||||
Error += Test > static_cast<valType>(3.14) ? 0 : 1; |
||||
Error += Test < static_cast<valType>(3.15) ? 0 : 1; |
||||
|
||||
return Error; |
||||
} |
||||
|
||||
int main() |
||||
{ |
||||
int Error = 0; |
||||
|
||||
Error += test_epsilon<float>(); |
||||
Error += test_epsilon<double>(); |
||||
Error += test_pi<float>(); |
||||
Error += test_pi<double>(); |
||||
|
||||
return Error; |
||||
} |
@ -0,0 +1,37 @@ |
||||
#include <glm/ext/scalar_float_sized.hpp> |
||||
|
||||
GLM_STATIC_ASSERT(sizeof(glm::float32) == 4, "float32 size isn't 4 bytes on this platform"); |
||||
|
||||
#ifndef GLM_FORCE_SINGLE_ONLY |
||||
GLM_STATIC_ASSERT(sizeof(glm::float64) == 8, "float64 size isn't 8 bytes on this platform"); |
||||
#endif//GLM_FORCE_SINGLE_ONLY
|
||||
|
||||
static int test_float_size() |
||||
{ |
||||
int Error = 0; |
||||
|
||||
Error += sizeof(glm::float32) == sizeof(float) ? 0 : 1; |
||||
Error += sizeof(glm::float64) == sizeof(double) ? 0 : 1; |
||||
|
||||
return Error; |
||||
} |
||||
|
||||
static int test_float_precision() |
||||
{ |
||||
int Error = 0; |
||||
|
||||
Error += sizeof(float) <= sizeof(double) ? 0 : 1; |
||||
Error += sizeof(glm::float32) < sizeof(glm::float64) ? 0 : 1; |
||||
|
||||
return Error; |
||||
} |
||||
|
||||
int main() |
||||
{ |
||||
int Error = 0; |
||||
|
||||
Error += test_float_size(); |
||||
Error += test_float_precision(); |
||||
|
||||
return Error; |
||||
} |
@ -0,0 +1,42 @@ |
||||
#include <glm/ext/scalar_int_sized.hpp> |
||||
|
||||
GLM_STATIC_ASSERT(sizeof(glm::int8) == 1, "int8 size isn't 1 byte on this platform"); |
||||
GLM_STATIC_ASSERT(sizeof(glm::int16) == 2, "int16 size isn't 2 bytes on this platform"); |
||||
GLM_STATIC_ASSERT(sizeof(glm::int32) == 4, "int32 size isn't 4 bytes on this platform"); |
||||
GLM_STATIC_ASSERT(sizeof(glm::int64) == 8, "int64 size isn't 8 bytes on this platform"); |
||||
|
||||
GLM_STATIC_ASSERT(sizeof(glm::int16) == sizeof(short), "signed short size isn't 4 bytes on this platform"); |
||||
GLM_STATIC_ASSERT(sizeof(glm::int32) == sizeof(int), "signed int size isn't 4 bytes on this platform"); |
||||
|
||||
static int test_size() |
||||
{ |
||||
int Error = 0; |
||||
|
||||
Error += sizeof(glm::int8) == 1 ? 0 : 1; |
||||
Error += sizeof(glm::int16) == 2 ? 0 : 1; |
||||
Error += sizeof(glm::int32) == 4 ? 0 : 1; |
||||
Error += sizeof(glm::int64) == 8 ? 0 : 1; |
||||
|
||||
return Error; |
||||
} |
||||
|
||||
static int test_comp() |
||||
{ |
||||
int Error = 0; |
||||
|
||||
Error += sizeof(glm::int8) < sizeof(glm::int16) ? 0 : 1; |
||||
Error += sizeof(glm::int16) < sizeof(glm::int32) ? 0 : 1; |
||||
Error += sizeof(glm::int32) < sizeof(glm::int64) ? 0 : 1; |
||||
|
||||
return Error; |
||||
} |
||||
|
||||
int main() |
||||
{ |
||||
int Error = 0; |
||||
|
||||
Error += test_size(); |
||||
Error += test_comp(); |
||||
|
||||
return Error; |
||||
} |
@ -0,0 +1,42 @@ |
||||
#include <glm/ext/scalar_uint_sized.hpp> |
||||
|
||||
GLM_STATIC_ASSERT(sizeof(glm::uint8) == 1, "uint8 size isn't 1 byte on this platform"); |
||||
GLM_STATIC_ASSERT(sizeof(glm::uint16) == 2, "uint16 size isn't 2 bytes on this platform"); |
||||
GLM_STATIC_ASSERT(sizeof(glm::uint32) == 4, "uint32 size isn't 4 bytes on this platform"); |
||||
GLM_STATIC_ASSERT(sizeof(glm::uint64) == 8, "uint64 size isn't 8 bytes on this platform"); |
||||
|
||||
GLM_STATIC_ASSERT(sizeof(glm::uint16) == sizeof(unsigned short), "unsigned short size isn't 4 bytes on this platform"); |
||||
GLM_STATIC_ASSERT(sizeof(glm::uint32) == sizeof(unsigned int), "unsigned int size isn't 4 bytes on this platform"); |
||||
|
||||
static int test_size() |
||||
{ |
||||
int Error = 0; |
||||
|
||||
Error += sizeof(glm::uint8) == 1 ? 0 : 1; |
||||
Error += sizeof(glm::uint16) == 2 ? 0 : 1; |
||||
Error += sizeof(glm::uint32) == 4 ? 0 : 1; |
||||
Error += sizeof(glm::uint64) == 8 ? 0 : 1; |
||||
|
||||
return Error; |
||||
} |
||||
|
||||
static int test_comp() |
||||
{ |
||||
int Error = 0; |
||||
|
||||
Error += sizeof(glm::uint8) < sizeof(glm::uint16) ? 0 : 1; |
||||
Error += sizeof(glm::uint16) < sizeof(glm::uint32) ? 0 : 1; |
||||
Error += sizeof(glm::uint32) < sizeof(glm::uint64) ? 0 : 1; |
||||
|
||||
return Error; |
||||
} |
||||
|
||||
int main() |
||||
{ |
||||
int Error = 0; |
||||
|
||||
Error += test_size(); |
||||
Error += test_comp(); |
||||
|
||||
return Error; |
||||
} |
Loading…
Reference in New Issue