Merge pull request #5 from cylgom/master

Unreachable ctors and missing includes
This commit is contained in:
Jack Andersen 2017-06-08 08:27:49 -10:00 committed by GitHub
commit 8bcecd4cda
5 changed files with 48 additions and 39 deletions

View File

@ -26,7 +26,9 @@ set(SOURCES
# SSELegacy.cpp compiled separately to escape the effects of link-time optimization
if(NOT MSVC)
set_source_files_properties(${SOURCES} PROPERTIES COMPILE_FLAGS "-msse4.1 -msse4.2 -std=c++14")
if(CUSTOM_FLAGS)
string(REPLACE "-flto=thin" "" CUSTOM_FLAGS ${CMAKE_CXX_FLAGS})
endif(CUSTOM_FLAGS)
if (CMAKE_OSX_DEPLOYMENT_TARGET AND NOT CMAKE_OSX_DEPLOYMENT_TARGET STREQUAL "")
set(CUSTOM_FLAGS "${CUSTOM_FLAGS} -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET} -O3 -msse3 -std=c++14")
else()

View File

@ -58,6 +58,35 @@ public:
#endif
}
operator atVec4f()
{
atVec4f ret;
#if __SSE__
ret.mVec128 = mVec128;
#else
ret.vec[0] = w;
ret.vec[1] = x;
ret.vec[2] = y;
ret.vec[3] = z;
#endif
return ret;
}
operator atVec4f() const
{
atVec4f ret;
#if __SSE__
ret.mVec128 = mVec128;
#else
ret.vec[0] = w;
ret.vec[1] = x;
ret.vec[2] = y;
ret.vec[3] = z;
#endif
return ret;
}
#endif
CQuaternion(const CMatrix3f& mat)
{
float trace = mat[0][0] + mat[1][1] + mat[2][2];
@ -98,34 +127,6 @@ public:
}
}
operator atVec4f()
{
atVec4f ret;
#if __SSE__
ret.mVec128 = mVec128;
#else
ret.vec[0] = w;
ret.vec[1] = x;
ret.vec[2] = y;
ret.vec[3] = z;
#endif
return ret;
}
operator atVec4f() const
{
atVec4f ret;
#if __SSE__
ret.mVec128 = mVec128;
#else
ret.vec[0] = w;
ret.vec[1] = x;
ret.vec[2] = y;
ret.vec[3] = z;
#endif
return ret;
}
#endif
CQuaternion(const CVector3f& vec) { fromVector3f(vec); }
CQuaternion(const CVector4f& vec)
{

View File

@ -5,6 +5,8 @@
#include "zeus/CMatrix3f.hpp"
#include "zeus/CMatrix4f.hpp"
#include "zeus/CVector3f.hpp"
#include <stdint.h>
#include <stdio.h>
namespace zeus
{

View File

@ -145,8 +145,9 @@ public:
inline CVector3d operator+(const CVector3d& rhs) const
{
#if __SSE__
return CVector3d({_mm_add_pd(mVec128[0], rhs.mVec128[0]),
_mm_add_pd(mVec128[1], rhs.mVec128[1])});
const __m128d tmpVec128[2] = {_mm_add_pd(mVec128[0], rhs.mVec128[0]),
_mm_add_pd(mVec128[1], rhs.mVec128[1])};
return CVector3d(tmpVec128);
#elif __GEKKO_PS__
return CVector3d(__mm_gekko_add_pd(mVec128, rhs.mVec128));
#else
@ -156,8 +157,9 @@ public:
inline CVector3d operator-(const CVector3d& rhs) const
{
#if __SSE__
return CVector3d({_mm_sub_pd(mVec128[0], rhs.mVec128[0]),
_mm_sub_pd(mVec128[1], rhs.mVec128[1])});
const __m128d tmpVec128[2] = {_mm_add_pd(mVec128[0], rhs.mVec128[0]),
_mm_add_pd(mVec128[1], rhs.mVec128[1])};
return CVector3d(tmpVec128);
#else
return CVector3d(x - rhs.x, y - rhs.y, z - rhs.z);
#endif
@ -165,8 +167,9 @@ public:
inline CVector3d operator*(const CVector3d& rhs) const
{
#if __SSE__
return CVector3d({_mm_mul_pd(mVec128[0], rhs.mVec128[0]),
_mm_mul_pd(mVec128[1], rhs.mVec128[1])});
const __m128d tmpVec128[2] = {_mm_add_pd(mVec128[0], rhs.mVec128[0]),
_mm_add_pd(mVec128[1], rhs.mVec128[1])};
return CVector3d(tmpVec128);
#else
return CVector3d(x * rhs.x, y * rhs.y, z * rhs.z);
#endif
@ -174,8 +177,9 @@ public:
inline CVector3d operator/(const CVector3d& rhs) const
{
#if __SSE__
return CVector3d({_mm_div_pd(mVec128[0], rhs.mVec128[0]),
_mm_div_pd(mVec128[1], rhs.mVec128[1])});
const __m128d tmpVec128[2] = {_mm_add_pd(mVec128[0], rhs.mVec128[0]),
_mm_add_pd(mVec128[1], rhs.mVec128[1])};
return CVector3d(tmpVec128);
#else
return CVector3d(x / rhs.x, y / rhs.y, z / rhs.z);
#endif

View File

@ -71,8 +71,6 @@ public:
return ret;
}
CVector3f(const CVector3d& vec);
void readBig(athena::io::IStreamReader& input)
{
x = input.readFloatBig();
@ -89,6 +87,8 @@ public:
}
#endif
CVector3f(const CVector3d& vec);
CVector3f(float xyz) { splat(xyz); }
void assign(float x, float y, float z)
{