Fixed some msvc warnings. Tested on msvc 2015 update 3.

This commit is contained in:
Aaron 2016-09-11 21:55:22 -07:00
parent 773389c400
commit ec5e34e04f
2 changed files with 14 additions and 1 deletions

View file

@ -317,6 +317,10 @@ namespace detail
template <typename T, glm::precision P, template <typename, glm::precision> class vecType>
GLM_FUNC_QUALIFIER vecType<int, P> bitCount(vecType<T, P> const & v)
{
#ifdef GLM_COMPILER_VC
#pragma warning(push)
#pragma warning(disable : 4310) //cast truncates constant value
#endif
vecType<typename detail::make_unsigned<T>::type, P> x(*reinterpret_cast<vecType<typename detail::make_unsigned<T>::type, P> const *>(&v));
x = detail::compute_bitfieldBitCountStep<typename detail::make_unsigned<T>::type, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 2>::call(x, typename detail::make_unsigned<T>::type(0x5555555555555555ull), typename detail::make_unsigned<T>::type( 1));
x = detail::compute_bitfieldBitCountStep<typename detail::make_unsigned<T>::type, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 4>::call(x, typename detail::make_unsigned<T>::type(0x3333333333333333ull), typename detail::make_unsigned<T>::type( 2));
@ -325,6 +329,9 @@ namespace detail
x = detail::compute_bitfieldBitCountStep<typename detail::make_unsigned<T>::type, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 32>::call(x, typename detail::make_unsigned<T>::type(0x0000FFFF0000FFFFull), typename detail::make_unsigned<T>::type(16));
x = detail::compute_bitfieldBitCountStep<typename detail::make_unsigned<T>::type, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 64>::call(x, typename detail::make_unsigned<T>::type(0x00000000FFFFFFFFull), typename detail::make_unsigned<T>::type(32));
return vecType<int, P>(x);
#ifdef GLM_COMPILER_VC
#pragma warning(pop)
#endif
}
// findLSB

View file

@ -9,6 +9,10 @@
namespace glm{
namespace detail
{
#ifdef GLM_COMPILER_VC
#pragma warning(push)
#pragma warning(disable : 4324) // structure was padded due to alignment specifier
#endif
template<std::size_t N> struct aligned {};
template<> GLM_ALIGNED_STRUCT(1) aligned<1>{};
template<> GLM_ALIGNED_STRUCT(2) aligned<2>{};
@ -17,7 +21,9 @@ namespace detail
template<> GLM_ALIGNED_STRUCT(16) aligned<16>{};
template<> GLM_ALIGNED_STRUCT(32) aligned<32>{};
template<> GLM_ALIGNED_STRUCT(64) aligned<64>{};
#ifdef GLM_COMPILER_VC
#pragma warning(pop)
#endif
template <typename T, std::size_t size, bool aligned>
struct storage
{