Skip to content
Snippets Groups Projects
Commit 5bc1cb4a authored by Rye Mutt's avatar Rye Mutt :bread:
Browse files

A few small changes until we're ready to go all-in on c++17 over-aligned allocation

parent c2f3847f
No related branches found
No related tags found
No related merge requests found
......@@ -32,10 +32,10 @@
#include "m4math.h"
#include "m3math.h"
class alignas(16) LLMatrix4a
LL_ALIGN_PREFIX(16) class LLMatrix4a
{
public:
LLVector4a mMatrix[4];
LL_ALIGN_PREFIX(16) LLVector4a mMatrix[4] LL_ALIGN_POSTFIX(16);
public:
enum
{
......@@ -45,6 +45,26 @@ class alignas(16) LLMatrix4a
ROW_TRANS
};
void* operator new(size_t size)
{
return ll_aligned_malloc_16(size);
}
void* operator new[](size_t size)
{
return ll_aligned_malloc_16(size);
}
void operator delete(void* ptr)
{
ll_aligned_free_16(ptr);
}
void operator delete[](void* ptr)
{
ll_aligned_free_16(ptr);
}
LLMatrix4a() = default;
LLMatrix4a(const LLQuad& q1,const LLQuad& q2,const LLQuad& q3,const LLQuad& q4)
{
......@@ -767,7 +787,7 @@ class alignas(16) LLMatrix4a
return _mm_movemask_epi8(_mm_castps_si128(_mm_and_ps(mask1, mask2))) == 0xFFFF;
}
};
} LL_ALIGN_POSTFIX(16);
#ifndef SHOW_ASSERT
static_assert(std::is_trivial<LLMatrix4a>::value, "LLMatrix4a must be a trivial type");
......
......@@ -66,11 +66,6 @@ class LLSimdScalar
mQ = _mm_set_ss(f);
}
static inline LLSimdScalar getZero()
{
return _mm_setzero_ps();
}
inline F32 getF32() const;
inline LLBool32 isApproximatelyEqual(const LLSimdScalar& rhs, F32 tolerance = F_APPROXIMATELY_ZERO) const;
......
......@@ -94,6 +94,26 @@ struct alignas(16) LLVector4a
static void memcpyNonAliased16(F32* __restrict dst, const F32* __restrict src, size_t bytes);
void* operator new(size_t size)
{
return ll_aligned_malloc_16(size);
}
void* operator new[](size_t size)
{
return ll_aligned_malloc_16(size);
}
void operator delete(void* ptr)
{
ll_aligned_free_16(ptr);
}
void operator delete[](void* ptr)
{
ll_aligned_free_16(ptr);
}
////////////////////////////////////
// CONSTRUCTORS
////////////////////////////////////
......@@ -380,7 +400,8 @@ inline std::ostream& operator<<(std::ostream& s, const LLVector4a& v)
return s;
}
struct alignas(16) LLIVector4a
LL_ALIGN_PREFIX(16)
struct LLIVector4a
{
friend struct LLVector4a;
......@@ -391,6 +412,26 @@ struct alignas(16) LLIVector4a
return _mm_setzero_si128();
}
void* operator new(size_t size)
{
return ll_aligned_malloc_16(size);
}
void* operator new[](size_t size)
{
return ll_aligned_malloc_16(size);
}
void operator delete(void* ptr)
{
ll_aligned_free_16(ptr);
}
void operator delete[](void* ptr)
{
ll_aligned_free_16(ptr);
}
////////////////////////////////////
// CONSTRUCTORS
////////////////////////////////////
......@@ -498,7 +539,7 @@ struct alignas(16) LLIVector4a
}
LLIQuad mQ;
};
} LL_ALIGN_POSTFIX(16);
static_assert(std::is_trivial<LLIVector4a>{}, "LLIVector4a must be a trivial type");
static_assert(std::is_standard_layout<LLIVector4a>{}, "LLIVector4a must be a standard layout type");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment