Browse Source

core: some clang and g++ 4.7 compilation fixes.

legacy
Sam Hocevar sam 12 years ago
parent
commit
b1d9c511bf
3 changed files with 44 additions and 15 deletions
  1. +7
    -7
      src/array.h
  2. +22
    -0
      src/lol/math/real.h
  3. +15
    -8
      src/lol/math/vector.h

+ 7
- 7
src/array.h View File

@@ -270,7 +270,7 @@ public:
{
T1 tmp1 = m1; T2 tmp2 = m2; T3 tmp3 = m3; T4 tmp4 = m4;
T5 tmp5 = m5; T6 tmp6 = m6; T7 tmp7 = m7; T8 tmp8 = m8;
Reserve(this->m_count * 13 / 8 + 8);
this->Reserve(this->m_count * 13 / 8 + 8);
this->m_data[this->m_count].m1 = tmp1;
this->m_data[this->m_count].m2 = tmp2;
this->m_data[this->m_count].m3 = tmp3;
@@ -309,7 +309,7 @@ public:
{
T1 tmp1 = m1; T2 tmp2 = m2; T3 tmp3 = m3; T4 tmp4 = m4;
T5 tmp5 = m5; T6 tmp6 = m6; T7 tmp7 = m7;
Reserve(this->m_count * 13 / 8 + 8);
this->Reserve(this->m_count * 13 / 8 + 8);
this->m_data[this->m_count].m1 = tmp1;
this->m_data[this->m_count].m2 = tmp2;
this->m_data[this->m_count].m3 = tmp3;
@@ -346,7 +346,7 @@ public:
{
T1 tmp1 = m1; T2 tmp2 = m2; T3 tmp3 = m3; T4 tmp4 = m4;
T5 tmp5 = m5; T6 tmp6 = m6;
Reserve(this->m_count * 13 / 8 + 8);
this->Reserve(this->m_count * 13 / 8 + 8);
this->m_data[this->m_count].m1 = tmp1;
this->m_data[this->m_count].m2 = tmp2;
this->m_data[this->m_count].m3 = tmp3;
@@ -380,7 +380,7 @@ public:
{
T1 tmp1 = m1; T2 tmp2 = m2; T3 tmp3 = m3; T4 tmp4 = m4;
T5 tmp5 = m5;
Reserve(this->m_count * 13 / 8 + 8);
this->Reserve(this->m_count * 13 / 8 + 8);
this->m_data[this->m_count].m1 = tmp1;
this->m_data[this->m_count].m2 = tmp2;
this->m_data[this->m_count].m3 = tmp3;
@@ -410,7 +410,7 @@ public:
if (this->m_count >= this->m_reserved)
{
T1 tmp1 = m1; T2 tmp2 = m2; T3 tmp3 = m3; T4 tmp4 = m4;
Reserve(this->m_count * 13 / 8 + 8);
this->Reserve(this->m_count * 13 / 8 + 8);
this->m_data[this->m_count].m1 = tmp1;
this->m_data[this->m_count].m2 = tmp2;
this->m_data[this->m_count].m3 = tmp3;
@@ -438,7 +438,7 @@ public:
if (this->m_count >= this->m_reserved)
{
T1 tmp1 = m1; T2 tmp2 = m2; T3 tmp3 = m3;
Reserve(this->m_count * 13 / 8 + 8);
this->Reserve(this->m_count * 13 / 8 + 8);
this->m_data[this->m_count].m1 = tmp1;
this->m_data[this->m_count].m2 = tmp2;
this->m_data[this->m_count].m3 = tmp3;
@@ -464,7 +464,7 @@ public:
if (this->m_count >= this->m_reserved)
{
T1 tmp1 = m1; T2 tmp2 = m2;
Reserve(this->m_count * 13 / 8 + 8);
this->Reserve(this->m_count * 13 / 8 + 8);
this->m_data[this->m_count].m1 = tmp1;
this->m_data[this->m_count].m2 = tmp2;
}


+ 22
- 0
src/lol/math/real.h View File

@@ -276,6 +276,28 @@ template<> real fmod(real const &x, real const &y);
template<> void real::hexprint() const;
template<> void real::print(int ndigits) const;

template<> real const real::R_0;
template<> real const real::R_1;
template<> real const real::R_2;
template<> real const real::R_3;
template<> real const real::R_10;

template<> real const real::R_LN2;
template<> real const real::R_LN10;
template<> real const real::R_LOG2E;
template<> real const real::R_LOG10E;
template<> real const real::R_E;
template<> real const real::R_PI;
template<> real const real::R_PI_2;
template<> real const real::R_PI_3;
template<> real const real::R_PI_4;
template<> real const real::R_1_PI;
template<> real const real::R_2_PI;
template<> real const real::R_2_SQRTPI;
template<> real const real::R_SQRT2;
template<> real const real::R_SQRT3;
template<> real const real::R_SQRT1_2;

} /* namespace lol */

#endif // __LOL_MATH_REAL_H__


+ 15
- 8
src/lol/math/vector.h View File

@@ -964,14 +964,7 @@ template <typename T> struct Quat
static Quat<T> fromeuler_zxy(T phi, T theta, T psi);
static Quat<T> fromeuler_zyx(T phi, T theta, T psi);

inline Quat<T> operator *(Quat<T> const &val) const
{
Quat<T> ret;
Vec3<T> v1(x, y, z);
Vec3<T> v2(val.x, val.y, val.z);
Vec3<T> v3 = cross(v1, v2) + w * v2 + val.w * v1;
return Quat<T>(w * val.w - dot(v1, v2), v3.x, v3.y, v3.z);
}
inline Quat<T> operator *(Quat<T> const &val) const;

inline Quat<T> operator *=(Quat<T> const &val)
{
@@ -1522,6 +1515,20 @@ ACTIVATE_COERCE_NAMESPACES(real)
#undef DECLARE_ALL_VECTOR_OPS_INNER
#undef DECLARE_ALL_VECTOR_OPS

/*
* Definition of additional functions requiring vector functions
*/

template<typename T>
inline Quat<T> Quat<T>::operator *(Quat<T> const &val) const
{
Quat<T> ret;
Vec3<T> v1(x, y, z);
Vec3<T> v2(val.x, val.y, val.z);
Vec3<T> v3 = cross(v1, v2) + w * v2 + val.w * v1;
return Quat<T>(w * val.w - dot(v1, v2), v3.x, v3.y, v3.z);
}

/*
* Magic vector swizzling (part 2/2)
* Unfortunately these assignment operators cannot be used for now, because


Loading…
Cancel
Save