mirror of
https://github.com/g-truc/glm.git
synced 2024-11-23 01:14:34 +00:00
Reduced warnings when using very strict compilation flags #646
This commit is contained in:
parent
27f8e5b0a1
commit
1ad55c5016
@ -14,7 +14,7 @@ include(CMakePackageConfigHelpers)
|
||||
|
||||
enable_testing()
|
||||
|
||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS -g -Weverything -Wpedantic -Werror -Wno-padded -Wno-c++98-compat -Wno-documentation -std=c++11)
|
||||
|
||||
option(GLM_STATIC_LIBRARY_ENABLE "GLM static library" OFF)
|
||||
if(GLM_STATIC_LIBRARY_ENABLE)
|
||||
|
@ -696,7 +696,15 @@ namespace detail
|
||||
|
||||
GLM_FUNC_QUALIFIER int floatBitsToInt(float const & v)
|
||||
{
|
||||
return reinterpret_cast<int&>(const_cast<float&>(v));
|
||||
union
|
||||
{
|
||||
float in;
|
||||
int out;
|
||||
} u;
|
||||
|
||||
u.in = v;
|
||||
|
||||
return u.out;
|
||||
}
|
||||
|
||||
template<template<length_t, typename, precision> class vecType, length_t L, precision P>
|
||||
@ -707,7 +715,15 @@ namespace detail
|
||||
|
||||
GLM_FUNC_QUALIFIER uint floatBitsToUint(float const & v)
|
||||
{
|
||||
return reinterpret_cast<uint&>(const_cast<float&>(v));
|
||||
union
|
||||
{
|
||||
float in;
|
||||
uint out;
|
||||
} u;
|
||||
|
||||
u.in = v;
|
||||
|
||||
return u.out;
|
||||
}
|
||||
|
||||
template<template<length_t, typename, precision> class vecType, length_t L, precision P>
|
||||
@ -718,7 +734,15 @@ namespace detail
|
||||
|
||||
GLM_FUNC_QUALIFIER float intBitsToFloat(int const & v)
|
||||
{
|
||||
return reinterpret_cast<float&>(const_cast<int&>(v));
|
||||
union
|
||||
{
|
||||
int in;
|
||||
float out;
|
||||
} u;
|
||||
|
||||
u.in = v;
|
||||
|
||||
return u.out;
|
||||
}
|
||||
|
||||
template<template<length_t, typename, precision> class vecType, length_t L, precision P>
|
||||
@ -729,7 +753,15 @@ namespace detail
|
||||
|
||||
GLM_FUNC_QUALIFIER float uintBitsToFloat(uint const & v)
|
||||
{
|
||||
return reinterpret_cast<float&>(const_cast<uint&>(v));
|
||||
union
|
||||
{
|
||||
uint in;
|
||||
float out;
|
||||
} u;
|
||||
|
||||
u.in = v;
|
||||
|
||||
return u.out;
|
||||
}
|
||||
|
||||
template<template<length_t, typename, precision> class vecType, length_t L, precision P>
|
||||
|
@ -191,7 +191,7 @@ namespace detail
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vec<4, float, P> call(vec<4, float, P> const & x, vec<4, float, P> const & y, vec<4, bool, P> const & a)
|
||||
{
|
||||
__m128i const Load = _mm_set_epi32(-(int)a.w, -(int)a.z, -(int)a.y, -(int)a.x);
|
||||
__m128i const Load = _mm_set_epi32(-static_cast<int>(a.w), -static_cast<int>(a.z), -static_cast<int>(a.y), -static_cast<int>(a.x));
|
||||
__m128 const Mask = _mm_castsi128_ps(Load);
|
||||
|
||||
vec<4, float, P> Result(uninitialize);
|
||||
|
@ -298,12 +298,12 @@ namespace detail
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> bitfieldReverse(vecType<L, T, P> const& v)
|
||||
{
|
||||
vecType<L, T, P> x(v);
|
||||
x = detail::compute_bitfieldReverseStep<L, T, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 2>::call(x, T(0x5555555555555555ull), static_cast<T>( 1));
|
||||
x = detail::compute_bitfieldReverseStep<L, T, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 4>::call(x, T(0x3333333333333333ull), static_cast<T>( 2));
|
||||
x = detail::compute_bitfieldReverseStep<L, T, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 8>::call(x, T(0x0F0F0F0F0F0F0F0Full), static_cast<T>( 4));
|
||||
x = detail::compute_bitfieldReverseStep<L, T, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 16>::call(x, T(0x00FF00FF00FF00FFull), static_cast<T>( 8));
|
||||
x = detail::compute_bitfieldReverseStep<L, T, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 32>::call(x, T(0x0000FFFF0000FFFFull), static_cast<T>(16));
|
||||
x = detail::compute_bitfieldReverseStep<L, T, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 64>::call(x, T(0x00000000FFFFFFFFull), static_cast<T>(32));
|
||||
x = detail::compute_bitfieldReverseStep<L, T, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 2>::call(x, static_cast<T>(0x5555555555555555ull), static_cast<T>( 1));
|
||||
x = detail::compute_bitfieldReverseStep<L, T, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 4>::call(x, static_cast<T>(0x3333333333333333ull), static_cast<T>( 2));
|
||||
x = detail::compute_bitfieldReverseStep<L, T, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 8>::call(x, static_cast<T>(0x0F0F0F0F0F0F0F0Full), static_cast<T>( 4));
|
||||
x = detail::compute_bitfieldReverseStep<L, T, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 16>::call(x, static_cast<T>(0x00FF00FF00FF00FFull), static_cast<T>( 8));
|
||||
x = detail::compute_bitfieldReverseStep<L, T, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 32>::call(x, static_cast<T>(0x0000FFFF0000FFFFull), static_cast<T>(16));
|
||||
x = detail::compute_bitfieldReverseStep<L, T, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 64>::call(x, static_cast<T>(0x00000000FFFFFFFFull), static_cast<T>(32));
|
||||
return x;
|
||||
}
|
||||
|
||||
|
@ -11,11 +11,11 @@ namespace detail
|
||||
template<glm::precision P>
|
||||
struct compute_bitfieldReverseStep<4, uint32, P, vec, true, true>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vec<4, uint32, P> call(vec<4, uint32, P> const & v, uint32 Mask, uint32 Shift)
|
||||
GLM_FUNC_QUALIFIER static vec<4, uint32, P> call(vec<4, uint32, P> const& v, uint32 Mask, uint32 Shift)
|
||||
{
|
||||
__m128i const set0 = v.data;
|
||||
|
||||
__m128i const set1 = _mm_set1_epi32(Mask);
|
||||
__m128i const set1 = _mm_set1_epi32(static_cast<int>(Mask));
|
||||
__m128i const and1 = _mm_and_si128(set0, set1);
|
||||
__m128i const sft1 = _mm_slli_epi32(and1, Shift);
|
||||
|
||||
@ -32,11 +32,11 @@ namespace detail
|
||||
template<glm::precision P>
|
||||
struct compute_bitfieldBitCountStep<4, uint32, P, vec, true, true>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vec<4, uint32, P> call(vec<4, uint32, P> const & v, uint32 Mask, uint32 Shift)
|
||||
GLM_FUNC_QUALIFIER static vec<4, uint32, P> call(vec<4, uint32, P> const& v, uint32 Mask, uint32 Shift)
|
||||
{
|
||||
__m128i const set0 = v.data;
|
||||
|
||||
__m128i const set1 = _mm_set1_epi32(Mask);
|
||||
__m128i const set1 = _mm_set1_epi32(static_cast<int>(Mask));
|
||||
__m128i const and0 = _mm_and_si128(set0, set1);
|
||||
__m128i const sft0 = _mm_slli_epi32(set0, Shift);
|
||||
__m128i const and1 = _mm_and_si128(sft0, set1);
|
||||
|
@ -19,9 +19,9 @@ namespace detail
|
||||
{
|
||||
mat<4, 4, float, P> result(uninitialize);
|
||||
glm_mat4_matrixCompMult(
|
||||
*(glm_vec4 const (*)[4])&x[0].data,
|
||||
*(glm_vec4 const (*)[4])&y[0].data,
|
||||
*(glm_vec4(*)[4])&result[0].data);
|
||||
*static_cast<glm_vec4 const (*)[4]>(&x[0].data),
|
||||
*static_cast<glm_vec4 const (*)[4]>(&y[0].data),
|
||||
*static_cast<glm_vec4(*)[4]>(&result[0].data));
|
||||
return result;
|
||||
}
|
||||
};
|
||||
@ -33,8 +33,8 @@ namespace detail
|
||||
{
|
||||
mat<4, 4, float, P> result(uninitialize);
|
||||
glm_mat4_transpose(
|
||||
*(glm_vec4 const (*)[4])&m[0].data,
|
||||
*(glm_vec4(*)[4])&result[0].data);
|
||||
*static_cast<glm_vec4 const (*)[4]>(&m[0].data),
|
||||
*static_cast<glm_vec4(*)[4]>(&result[0].data));
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
@ -46,7 +46,7 @@ namespace detail
|
||||
//
|
||||
|
||||
detail::uif32 result;
|
||||
result.i = (unsigned int)(s << 31);
|
||||
result.i = static_cast<unsigned int>(s << 31);
|
||||
return result.f;
|
||||
}
|
||||
else
|
||||
@ -74,7 +74,7 @@ namespace detail
|
||||
//
|
||||
|
||||
uif32 result;
|
||||
result.i = (unsigned int)((s << 31) | 0x7f800000);
|
||||
result.i = static_cast<unsigned int>((s << 31) | 0x7f800000);
|
||||
return result.f;
|
||||
}
|
||||
else
|
||||
@ -84,7 +84,7 @@ namespace detail
|
||||
//
|
||||
|
||||
uif32 result;
|
||||
result.i = (unsigned int)((s << 31) | 0x7f800000 | (m << 13));
|
||||
result.i = static_cast<unsigned int>((s << 31) | 0x7f800000 | (m << 13));
|
||||
return result.f;
|
||||
}
|
||||
}
|
||||
@ -101,15 +101,15 @@ namespace detail
|
||||
//
|
||||
|
||||
uif32 Result;
|
||||
Result.i = (unsigned int)((s << 31) | (e << 23) | m);
|
||||
Result.i = static_cast<unsigned int>((s << 31) | (e << 23) | m);
|
||||
return Result.f;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER hdata toFloat16(float const & f)
|
||||
GLM_FUNC_QUALIFIER hdata toFloat16(float const& f)
|
||||
{
|
||||
uif32 Entry;
|
||||
Entry.f = f;
|
||||
int i = (int)Entry.i;
|
||||
int i = static_cast<int>(Entry.i);
|
||||
|
||||
//
|
||||
// Our floating point number, f, is represented by the bit
|
||||
|
@ -73,7 +73,8 @@ glm::mat4 camera(float Translate, glm::vec2 const & Rotate)
|
||||
- Added FAQ 12: Windows headers cause build errors... #557
|
||||
- Removed GCC shadow warnings #595
|
||||
- Added error for including of different versions of GLM #619
|
||||
- Added GLM_FORCE_IGNORE_VERSION to ignore error caused by including different version of GLM #619
|
||||
- Added GLM_FORCE_IGNORE_VERSION to ignore error caused by including different version of GLM #619
|
||||
- Reduced warnings when using very strict compilation flags #646
|
||||
|
||||
#### Fixes:
|
||||
- Removed doxygen references to GTC_half_float which was removed in 0.9.4
|
||||
|
Loading…
Reference in New Issue
Block a user