Rip out old workarounds, hacks and macros for newer C++ features not being supported back in the day.
Adds LL_COMPILE_TIME_MESSAGE support to Linux. llfinite -> std::isfinite llisnan -> std::isnan vector_shrink_to_fit -> vector.shrink_to_fit
This commit is contained in:
@@ -161,7 +161,7 @@ private:
|
||||
F32 _min(const F32& a, const F32& b) const { return llmin(a, b); }
|
||||
F32 _max(const F32& a, const F32& b) const { return llmax(a, b); }
|
||||
|
||||
bool checkNaN(const F32& a) const { return !llisnan(a); }
|
||||
bool checkNaN(const F32& a) const { return !std::isnan(a); }
|
||||
|
||||
//FIX* non ambiguous function fix making SIN() work for calc -Cryogenic Blitz
|
||||
F32 _sin(const F32& a) const { return sin(DEG_TO_RAD * a); }
|
||||
|
||||
@@ -41,23 +41,6 @@
|
||||
// llcommon depend on llmath.
|
||||
#include "is_approx_equal_fraction.h"
|
||||
|
||||
|
||||
// work around for Windows & older gcc non-standard function names.
|
||||
#if LL_WINDOWS
|
||||
#include <float.h>
|
||||
#define llisnan(val) _isnan(val)
|
||||
#define llfinite(val) _finite(val)
|
||||
#elif (LL_LINUX && __GNUC__ <= 2)
|
||||
#define llisnan(val) isnan(val)
|
||||
#define llfinite(val) isfinite(val)
|
||||
#elif LL_SOLARIS
|
||||
#define llisnan(val) isnan(val)
|
||||
#define llfinite(val) (val <= std::numeric_limits<double>::max())
|
||||
#else
|
||||
#define llisnan(val) std::isnan(val)
|
||||
#define llfinite(val) std::isfinite(val)
|
||||
#endif
|
||||
|
||||
// Single Precision Floating Point Routines
|
||||
// (There used to be more defined here, but they appeared to be redundant and
|
||||
// were breaking some other includes. Removed by Falcon, reviewed by Andrew, 11/25/09)
|
||||
@@ -156,36 +139,12 @@ inline F64 llabs(const F64 a)
|
||||
|
||||
inline S32 lltrunc( F32 f )
|
||||
{
|
||||
#if LL_WINDOWS && !defined( __INTEL_COMPILER ) && !defined(_WIN64) && !(_MSC_VER >= 1800)
|
||||
// Avoids changing the floating point control word.
|
||||
// Add or subtract 0.5 - epsilon and then round
|
||||
const static U32 zpfp[] = { 0xBEFFFFFF, 0x3EFFFFFF };
|
||||
S32 result;
|
||||
__asm {
|
||||
fld f
|
||||
mov eax, f
|
||||
shr eax, 29
|
||||
and eax, 4
|
||||
fadd dword ptr [zpfp + eax]
|
||||
fistp result
|
||||
}
|
||||
return result;
|
||||
#else
|
||||
#ifdef LL_CPP11
|
||||
return (S32)trunc(f);
|
||||
#else
|
||||
return (S32)f;
|
||||
#endif
|
||||
#endif
|
||||
return (S32)trunc(f);
|
||||
}
|
||||
|
||||
inline S32 lltrunc( F64 f )
|
||||
{
|
||||
#ifdef LL_CPP11
|
||||
return (S32)trunc(f);
|
||||
#else
|
||||
return (S32)f;
|
||||
#endif
|
||||
}
|
||||
|
||||
inline S32 llfloor( F32 f )
|
||||
@@ -217,29 +176,17 @@ inline S32 llceil( F32 f )
|
||||
// Use this round. Does an arithmetic round (0.5 always rounds up)
|
||||
inline S32 ll_round(const F32 val)
|
||||
{
|
||||
#ifdef LL_CPP11
|
||||
return (S32)round(val);
|
||||
#else
|
||||
return llfloor(val + 0.5f);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline F32 ll_round(F32 val, F32 nearest)
|
||||
{
|
||||
#ifdef LL_CPP11
|
||||
return F32(round(val * (1.0f / nearest))) * nearest;
|
||||
#else
|
||||
return F32(floor(val * (1.0f / nearest) + 0.5f)) * nearest;
|
||||
#endif
|
||||
}
|
||||
|
||||
inline F64 ll_round(F64 val, F64 nearest)
|
||||
{
|
||||
#ifdef LL_CPP11
|
||||
return F64(round(val * (1.0 / nearest))) * nearest;
|
||||
#else
|
||||
return F64(floor(val * (1.0 / nearest) + 0.5)) * nearest;
|
||||
#endif
|
||||
}
|
||||
|
||||
// these provide minimum peak error
|
||||
|
||||
@@ -696,7 +696,7 @@ public:
|
||||
(mData.size() > gOctreeReserveCapacity && mData.capacity() > gOctreeReserveCapacity + mData.size() - 1 - (mData.size() - gOctreeReserveCapacity - 1) % 4))
|
||||
{
|
||||
//Shrink to lowest possible (reserve)+4*i size.. Say reserve is 5, here are [size,capacity] pairs. [10,13],[9,9],[8,9],[7,9],[6,9],[5,5],[4,5],[3,5],[2,5],[1,5],[0,5]
|
||||
vector_shrink_to_fit(mData);
|
||||
mData.shrink_to_fit();
|
||||
}
|
||||
#ifdef LL_OCTREE_STATS
|
||||
if(old_cap != mData.capacity())
|
||||
|
||||
@@ -166,7 +166,7 @@ public:
|
||||
// checker
|
||||
inline BOOL LLQuaternion::isFinite() const
|
||||
{
|
||||
return (llfinite(mQ[VX]) && llfinite(mQ[VY]) && llfinite(mQ[VZ]) && llfinite(mQ[VS]));
|
||||
return (std::isfinite(mQ[VX]) && std::isfinite(mQ[VY]) && std::isfinite(mQ[VZ]) && std::isfinite(mQ[VS]));
|
||||
}
|
||||
|
||||
inline BOOL LLQuaternion::isIdentity() const
|
||||
|
||||
@@ -167,8 +167,8 @@ void calc_tangent_from_triangle(
|
||||
float r = ((rd*rd) > FLT_EPSILON) ? (1.0f / rd)
|
||||
: ((rd > 0.0f) ? 1024.f : -1024.f); //some made up large ratio for division by zero
|
||||
|
||||
llassert(llfinite(r));
|
||||
llassert(!llisnan(r));
|
||||
llassert(std::isfinite(r));
|
||||
llassert(!std::isnan(r));
|
||||
|
||||
LLVector4a sdir(
|
||||
(t2 * x1 - t1 * x2) * r,
|
||||
@@ -5989,13 +5989,13 @@ BOOL LLVolumeFace::createCap(LLVolume* volume, BOOL partial_build)
|
||||
normal.set(0,0,1);
|
||||
}
|
||||
|
||||
llassert(llfinite(normal.getF32ptr()[0]));
|
||||
llassert(llfinite(normal.getF32ptr()[1]));
|
||||
llassert(llfinite(normal.getF32ptr()[2]));
|
||||
llassert(std::isfinite(normal.getF32ptr()[0]));
|
||||
llassert(std::isfinite(normal.getF32ptr()[1]));
|
||||
llassert(std::isfinite(normal.getF32ptr()[2]));
|
||||
|
||||
llassert(!llisnan(normal.getF32ptr()[0]));
|
||||
llassert(!llisnan(normal.getF32ptr()[1]));
|
||||
llassert(!llisnan(normal.getF32ptr()[2]));
|
||||
llassert(!std::isnan(normal.getF32ptr()[0]));
|
||||
llassert(!std::isnan(normal.getF32ptr()[1]));
|
||||
llassert(!std::isnan(normal.getF32ptr()[2]));
|
||||
|
||||
for (S32 i = 0; i < num_vertices; i++)
|
||||
{
|
||||
@@ -6810,8 +6810,8 @@ void CalculateTangentArray(U32 vertexCount, const LLVector4a *vertex, const LLVe
|
||||
float r = ((rd*rd) > FLT_EPSILON) ? (1.0f / rd)
|
||||
: ((rd > 0.0f) ? 1024.f : -1024.f); //some made up large ratio for division by zero
|
||||
|
||||
llassert(llfinite(r));
|
||||
llassert(!llisnan(r));
|
||||
llassert(std::isfinite(r));
|
||||
llassert(!std::isnan(r));
|
||||
|
||||
LLVector4a sdir((t2 * x1 - t1 * x2) * r, (t2 * y1 - t1 * y2) * r,
|
||||
(t2 * z1 - t1 * z2) * r);
|
||||
|
||||
@@ -250,7 +250,7 @@ inline F32 LLVector2::normalize(void)
|
||||
// checker
|
||||
inline bool LLVector2::isFinite() const
|
||||
{
|
||||
return (llfinite(mV[VX]) && llfinite(mV[VY]));
|
||||
return (std::isfinite(mV[VX]) && std::isfinite(mV[VY]));
|
||||
}
|
||||
|
||||
// deprecated
|
||||
|
||||
@@ -191,7 +191,7 @@ inline LLVector3d::LLVector3d(const LLVector3d ©)
|
||||
// checker
|
||||
inline BOOL LLVector3d::isFinite() const
|
||||
{
|
||||
return (llfinite(mdV[VX]) && llfinite(mdV[VY]) && llfinite(mdV[VZ]));
|
||||
return (std::isfinite(mdV[VX]) && std::isfinite(mdV[VY]) && std::isfinite(mdV[VZ]));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ BOOL LLVector3::clampLength( F32 length_limit )
|
||||
BOOL changed = FALSE;
|
||||
|
||||
F32 len = length();
|
||||
if (llfinite(len))
|
||||
if (std::isfinite(len))
|
||||
{
|
||||
if ( len > length_limit)
|
||||
{
|
||||
@@ -97,7 +97,7 @@ BOOL LLVector3::clampLength( F32 length_limit )
|
||||
for (S32 i = 0; i < 3; ++i)
|
||||
{
|
||||
F32 abs_component = fabs(mV[i]);
|
||||
if (llfinite(abs_component))
|
||||
if (std::isfinite(abs_component))
|
||||
{
|
||||
if (abs_component > max_abs_component)
|
||||
{
|
||||
|
||||
@@ -199,7 +199,7 @@ inline LLVector3::LLVector3(const LLVector3 ©)
|
||||
// checker
|
||||
inline BOOL LLVector3::isFinite() const
|
||||
{
|
||||
return (llfinite(mV[VX]) && llfinite(mV[VY]) && llfinite(mV[VZ]));
|
||||
return (std::isfinite(mV[VX]) && std::isfinite(mV[VY]) && std::isfinite(mV[VZ]));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -194,7 +194,7 @@ inline LLVector4::LLVector4(const LLVector3 &vec, F32 w)
|
||||
|
||||
inline BOOL LLVector4::isFinite() const
|
||||
{
|
||||
return (llfinite(mV[VX]) && llfinite(mV[VY]) && llfinite(mV[VZ]) && llfinite(mV[VW]));
|
||||
return (std::isfinite(mV[VX]) && std::isfinite(mV[VY]) && std::isfinite(mV[VZ]) && std::isfinite(mV[VW]));
|
||||
}
|
||||
|
||||
// Clear and Assignment Functions
|
||||
|
||||
@@ -200,7 +200,7 @@ void LLXform::setPosition(const LLVector3& pos)
|
||||
void LLXform::setPosition(const F32 x, const F32 y, const F32 z)
|
||||
{
|
||||
setChanged(TRANSLATED);
|
||||
if (llfinite(x) && llfinite(y) && llfinite(z))
|
||||
if (std::isfinite(x) && std::isfinite(y) && std::isfinite(z))
|
||||
mPosition.setVec(x,y,z);
|
||||
else
|
||||
{
|
||||
@@ -212,7 +212,7 @@ void LLXform::setPosition(const F32 x, const F32 y, const F32 z)
|
||||
void LLXform::setPositionX(const F32 x)
|
||||
{
|
||||
setChanged(TRANSLATED);
|
||||
if (llfinite(x))
|
||||
if (std::isfinite(x))
|
||||
mPosition.mV[VX] = x;
|
||||
else
|
||||
{
|
||||
@@ -224,7 +224,7 @@ void LLXform::setPositionX(const F32 x)
|
||||
void LLXform::setPositionY(const F32 y)
|
||||
{
|
||||
setChanged(TRANSLATED);
|
||||
if (llfinite(y))
|
||||
if (std::isfinite(y))
|
||||
mPosition.mV[VY] = y;
|
||||
else
|
||||
{
|
||||
@@ -236,7 +236,7 @@ void LLXform::setPositionY(const F32 y)
|
||||
void LLXform::setPositionZ(const F32 z)
|
||||
{
|
||||
setChanged(TRANSLATED);
|
||||
if (llfinite(z))
|
||||
if (std::isfinite(z))
|
||||
mPosition.mV[VZ] = z;
|
||||
else
|
||||
{
|
||||
@@ -268,7 +268,7 @@ void LLXform::setScale(const LLVector3& scale)
|
||||
void LLXform::setScale(const F32 x, const F32 y, const F32 z)
|
||||
{
|
||||
setChanged(SCALED);
|
||||
if (llfinite(x) && llfinite(y) && llfinite(z))
|
||||
if (std::isfinite(x) && std::isfinite(y) && std::isfinite(z))
|
||||
mScale.setVec(x,y,z);
|
||||
else
|
||||
{
|
||||
@@ -290,7 +290,7 @@ void LLXform::setRotation(const LLQuaternion& rot)
|
||||
void LLXform::setRotation(const F32 x, const F32 y, const F32 z)
|
||||
{
|
||||
setChanged(ROTATED);
|
||||
if (llfinite(x) && llfinite(y) && llfinite(z))
|
||||
if (std::isfinite(x) && std::isfinite(y) && std::isfinite(z))
|
||||
{
|
||||
mRotation.setQuat(x,y,z);
|
||||
}
|
||||
@@ -303,7 +303,7 @@ void LLXform::setRotation(const F32 x, const F32 y, const F32 z)
|
||||
void LLXform::setRotation(const F32 x, const F32 y, const F32 z, const F32 s)
|
||||
{
|
||||
setChanged(ROTATED);
|
||||
if (llfinite(x) && llfinite(y) && llfinite(z) && llfinite(s))
|
||||
if (std::isfinite(x) && std::isfinite(y) && std::isfinite(z) && std::isfinite(s))
|
||||
{
|
||||
mRotation.mQ[VX] = x; mRotation.mQ[VY] = y; mRotation.mQ[VZ] = z; mRotation.mQ[VS] = s;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user