Update macro define limited

This commit is contained in:
samuele3hu 2014-09-09 19:08:01 +08:00
parent 40ace8f539
commit 3151c54879
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) void Mat4::add(float scalar, Mat4* dst)
{ {
GP_ASSERT(dst); GP_ASSERT(dst);
#ifdef __SSE__ #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) && defined (__SSE__)
MathUtil::addMatrix(col, scalar, dst->col); MathUtil::addMatrix(col, scalar, dst->col);
#else #else
MathUtil::addMatrix(m, scalar, dst->m); 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) void Mat4::add(const Mat4& m1, const Mat4& m2, Mat4* dst)
{ {
GP_ASSERT(dst); GP_ASSERT(dst);
#ifdef __SSE__ #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) && defined (__SSE__)
MathUtil::addMatrix(m1.col, m2.col, dst->col); MathUtil::addMatrix(m1.col, m2.col, dst->col);
#else #else
MathUtil::addMatrix(m1.m, m2.m, dst->m); 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) void Mat4::multiply(const Mat4& m, float scalar, Mat4* dst)
{ {
GP_ASSERT(dst); GP_ASSERT(dst);
#ifdef __SSE__ #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) && defined (__SSE__)
MathUtil::multiplyMatrix(m.col, scalar, dst->col); MathUtil::multiplyMatrix(m.col, scalar, dst->col);
#else #else
MathUtil::multiplyMatrix(m.m, scalar, dst->m); 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) void Mat4::multiply(const Mat4& m1, const Mat4& m2, Mat4* dst)
{ {
GP_ASSERT(dst); GP_ASSERT(dst);
#ifdef __SSE__ #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) && defined (__SSE__)
MathUtil::multiplyMatrix(m1.col, m2.col, dst->col); MathUtil::multiplyMatrix(m1.col, m2.col, dst->col);
#else #else
MathUtil::multiplyMatrix(m1.m, m2.m, dst->m); 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() void Mat4::negate()
{ {
#ifdef __SSE__ #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) && defined (__SSE__)
MathUtil::negateMatrix(col, col); MathUtil::negateMatrix(col, col);
#else #else
MathUtil::negateMatrix(m, m); 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) void Mat4::subtract(const Mat4& m1, const Mat4& m2, Mat4* dst)
{ {
GP_ASSERT(dst); GP_ASSERT(dst);
#ifdef __SSE__ #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) && defined (__SSE__)
MathUtil::subtractMatrix(m1.col, m2.col, dst->col); MathUtil::subtractMatrix(m1.col, m2.col, dst->col);
#else #else
MathUtil::subtractMatrix(m1.m, m2.m, dst->m); 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 void Mat4::transformVector(const Vec4& vector, Vec4* dst) const
{ {
GP_ASSERT(dst); GP_ASSERT(dst);
#ifdef __SSE__ #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) && defined (__SSE__)
MathUtil::transformVec4(col, vector.v, dst->v); MathUtil::transformVec4(col, vector.v, dst->v);
#else #else
MathUtil::transformVec4(m, (const float*) &vector, (float*)dst); MathUtil::transformVec4(m, (const float*) &vector, (float*)dst);
@ -962,7 +962,7 @@ void Mat4::translate(const Vec3& t, Mat4* dst) const
void Mat4::transpose() void Mat4::transpose()
{ {
#ifdef __SSE__ #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) && defined (__SSE__)
MathUtil::transposeMatrix(col, col); MathUtil::transposeMatrix(col, col);
#else #else
MathUtil::transposeMatrix(m, m); MathUtil::transposeMatrix(m, m);

View File

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

View File

@ -21,7 +21,7 @@
#ifndef MATHUTIL_H_ #ifndef MATHUTIL_H_
#define MATHUTIL_H_ #define MATHUTIL_H_
#ifdef __SSE__ #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) && defined (__SSE__)
#include <xmmintrin.h> #include <xmmintrin.h>
#endif #endif
@ -71,7 +71,7 @@ public:
static void smooth(float* x, float target, float elapsedTime, float riseTime, float fallTime); static void smooth(float* x, float target, float elapsedTime, float riseTime, float fallTime);
private: private:
#ifdef __SSE__ #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) && defined (__SSE__)
inline static void addMatrix(const __m128 m[4], float scalar, __m128 dst[4]); 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]); 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 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]) inline void MathUtil::addMatrix(const __m128 m[4], float scalar, __m128 dst[4])
{ {
__m128 s = _mm_set1_ps(scalar); __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)) _mm_add_ps(_mm_mul_ps(m[2], col3), _mm_mul_ps(m[3], col4))
); );
} }
#endif
NS_CC_MATH_END NS_CC_MATH_END

View File

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