Skip to content

Commit

Permalink
Changed how storage alignment is created to eliminate warnings on msvc.
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron committed Sep 13, 2016
1 parent 460b6ba commit e57615b
Showing 1 changed file with 14 additions and 23 deletions.
37 changes: 14 additions & 23 deletions glm/detail/type_vec.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,6 @@
namespace glm{
namespace detail
{
#if GLM_COMPILER & 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>{};
template<> GLM_ALIGNED_STRUCT(4) aligned<4>{};
template<> GLM_ALIGNED_STRUCT(8) aligned<8>{};
template<> GLM_ALIGNED_STRUCT(16) aligned<16>{};
template<> GLM_ALIGNED_STRUCT(32) aligned<32>{};
template<> GLM_ALIGNED_STRUCT(64) aligned<64>{};
#if GLM_COMPILER & GLM_COMPILER_VC
#pragma warning(pop)
#endif

template <typename T, std::size_t size, bool aligned>
struct storage
{
Expand All @@ -33,15 +17,22 @@ namespace detail
} type;
};

template <typename T, std::size_t size>
struct storage<T, size, true>
{
struct type : aligned<size>
{
uint8 data[size];
#define GLM_ALIGNED_STORAGE_TYPE_STRUCT(x) \
template <typename T> \
struct storage<T, x, true> { \
GLM_ALIGNED_STRUCT(x) type { \
uint8_t data[x]; \
}; \
};
};

GLM_ALIGNED_STORAGE_TYPE_STRUCT(1)
GLM_ALIGNED_STORAGE_TYPE_STRUCT(2)
GLM_ALIGNED_STORAGE_TYPE_STRUCT(4)
GLM_ALIGNED_STORAGE_TYPE_STRUCT(8)
GLM_ALIGNED_STORAGE_TYPE_STRUCT(16)
GLM_ALIGNED_STORAGE_TYPE_STRUCT(32)
GLM_ALIGNED_STORAGE_TYPE_STRUCT(64)

# if GLM_ARCH & GLM_ARCH_SSE2_BIT
template <>
struct storage<float, 16, true>
Expand Down

0 comments on commit e57615b

Please sign in to comment.