Reset marco limited to `#ifdef __SSE__`

This commit is contained in:
samuele3hu 2014-09-09 23:01:37 +08:00
parent 3151c54879
commit 8c0f8e1eb6
5 changed files with 16 additions and 16 deletions

View File

@ -414,7 +414,7 @@ void Mat4::add(float scalar)
void Mat4::add(float scalar, Mat4* dst)
{
GP_ASSERT(dst);
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) && defined (__SSE__)
#ifdef __SSE__
MathUtil::addMatrix(col, scalar, dst->col);
#else
MathUtil::addMatrix(m, scalar, dst->m);
@ -429,7 +429,7 @@ void Mat4::add(const Mat4& mat)
void Mat4::add(const Mat4& m1, const Mat4& m2, Mat4* dst)
{
GP_ASSERT(dst);
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) && defined (__SSE__)
#ifdef __SSE__
MathUtil::addMatrix(m1.col, m2.col, dst->col);
#else
MathUtil::addMatrix(m1.m, m2.m, dst->m);
@ -706,7 +706,7 @@ void Mat4::multiply(float scalar, Mat4* dst) const
void Mat4::multiply(const Mat4& m, float scalar, Mat4* dst)
{
GP_ASSERT(dst);
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) && defined (__SSE__)
#ifdef __SSE__
MathUtil::multiplyMatrix(m.col, scalar, dst->col);
#else
MathUtil::multiplyMatrix(m.m, scalar, dst->m);
@ -721,7 +721,7 @@ void Mat4::multiply(const Mat4& mat)
void Mat4::multiply(const Mat4& m1, const Mat4& m2, Mat4* dst)
{
GP_ASSERT(dst);
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) && defined (__SSE__)
#ifdef __SSE__
MathUtil::multiplyMatrix(m1.col, m2.col, dst->col);
#else
MathUtil::multiplyMatrix(m1.m, m2.m, dst->m);
@ -730,7 +730,7 @@ void Mat4::multiply(const Mat4& m1, const Mat4& m2, Mat4* dst)
void Mat4::negate()
{
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) && defined (__SSE__)
#ifdef __SSE__
MathUtil::negateMatrix(col, col);
#else
MathUtil::negateMatrix(m, m);
@ -886,7 +886,7 @@ void Mat4::subtract(const Mat4& mat)
void Mat4::subtract(const Mat4& m1, const Mat4& m2, Mat4* dst)
{
GP_ASSERT(dst);
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) && defined (__SSE__)
#ifdef __SSE__
MathUtil::subtractMatrix(m1.col, m2.col, dst->col);
#else
MathUtil::subtractMatrix(m1.m, m2.m, dst->m);
@ -931,7 +931,7 @@ void Mat4::transformVector(Vec4* vector) const
void Mat4::transformVector(const Vec4& vector, Vec4* dst) const
{
GP_ASSERT(dst);
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) && defined (__SSE__)
#ifdef __SSE__
MathUtil::transformVec4(col, vector.v, dst->v);
#else
MathUtil::transformVec4(m, (const float*) &vector, (float*)dst);
@ -962,7 +962,7 @@ void Mat4::translate(const Vec3& t, Mat4* dst) const
void Mat4::transpose()
{
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) && defined (__SSE__)
#ifdef __SSE__
MathUtil::transposeMatrix(col, col);
#else
MathUtil::transposeMatrix(m, m);

View File

@ -24,7 +24,7 @@
#include "math/Vec3.h"
#include "math/Vec4.h"
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) && defined (__SSE__)
#ifdef __SSE__
#include <xmmintrin.h>
#endif
@ -81,7 +81,7 @@ public:
/**
* Stores the columns of this 4x4 matrix.
* */
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) && defined (__SSE__)
#ifdef __SSE__
union {
__m128 col[4];
float m[16];

View File

@ -21,7 +21,7 @@
#ifndef MATHUTIL_H_
#define MATHUTIL_H_
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) && defined (__SSE__)
#ifdef __SSE__
#include <xmmintrin.h>
#endif
@ -71,7 +71,7 @@ public:
static void smooth(float* x, float target, float elapsedTime, float riseTime, float fallTime);
private:
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) && defined (__SSE__)
#ifdef __SSE__
inline static void addMatrix(const __m128 m[4], float scalar, __m128 dst[4]);
inline static void addMatrix(const __m128 m1[4], const __m128 m2[4], __m128 dst[4]);

View File

@ -1,5 +1,5 @@
NS_CC_MATH_BEGIN
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) && defined (__SSE__)
inline void MathUtil::addMatrix(const __m128 m[4], float scalar, __m128 dst[4])
{
__m128 s = _mm_set1_ps(scalar);
@ -148,5 +148,5 @@ inline void MathUtil::transformVec4(const __m128 m[4], const __m128& v, __m128&
_mm_add_ps(_mm_mul_ps(m[2], col3), _mm_mul_ps(m[3], col4))
);
}
#endif
NS_CC_MATH_END

View File

@ -21,7 +21,7 @@
#ifndef MATH_VEC4_H
#define MATH_VEC4_H
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) && defined (__SSE__)
#ifdef __SSE__
#include <xmmintrin.h>
#endif
@ -37,7 +37,7 @@ class Mat4;
class CC_DLL Vec4
{
public:
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) && defined (__SSE__)
#ifdef __SSE__
union {
struct {
float x;