summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/llcommon/lltraceaccumulators.h40
-rw-r--r--indra/llcommon/llunit.h100
-rwxr-xr-xindra/llmath/llmath.h6
-rwxr-xr-xindra/newview/llface.cpp10
-rwxr-xr-xindra/newview/llfasttimerview.cpp2
5 files changed, 82 insertions, 76 deletions
diff --git a/indra/llcommon/lltraceaccumulators.h b/indra/llcommon/lltraceaccumulators.h
index efc8b43f6a..b1aa078f9a 100644
--- a/indra/llcommon/lltraceaccumulators.h
+++ b/indra/llcommon/lltraceaccumulators.h
@@ -223,7 +223,7 @@ namespace LLTrace
mMin((std::numeric_limits<F64>::max)()),
mMax((std::numeric_limits<F64>::min)()),
mMean(0),
- mVarianceSum(0),
+ mSumOfSquares(0),
mNumSamples(0),
mLastValue(0)
{}
@@ -243,7 +243,7 @@ namespace LLTrace
}
F64 old_mean = mMean;
mMean += (value - old_mean) / (F64)mNumSamples;
- mVarianceSum += (value - old_mean) * (value - mMean);
+ mSumOfSquares += (value - old_mean) * (value - mMean);
mLastValue = value;
}
@@ -263,20 +263,20 @@ namespace LLTrace
n_2 = (F64)other.mNumSamples;
F64 m_1 = mMean,
m_2 = other.mMean;
- F64 v_1 = mVarianceSum / mNumSamples,
- v_2 = other.mVarianceSum / other.mNumSamples;
+ F64 v_1 = mSumOfSquares / mNumSamples,
+ v_2 = other.mSumOfSquares / other.mNumSamples;
if (n_1 == 0)
{
- mVarianceSum = other.mVarianceSum;
+ mSumOfSquares = other.mSumOfSquares;
}
else if (n_2 == 0)
{
// don't touch variance
- // mVarianceSum = mVarianceSum;
+ // mSumOfSquares = mSumOfSquares;
}
else
{
- mVarianceSum = (F64)mNumSamples
+ mSumOfSquares = (F64)mNumSamples
* ((((n_1 - 1.f) * v_1)
+ ((n_2 - 1.f) * v_2)
+ (((n_1 * n_2) / (n_1 + n_2))
@@ -298,7 +298,7 @@ namespace LLTrace
mMin = std::numeric_limits<F64>::max();
mMax = std::numeric_limits<F64>::min();
mMean = 0;
- mVarianceSum = 0;
+ mSumOfSquares = 0;
mLastValue = other ? other->mLastValue : 0;
}
@@ -309,7 +309,7 @@ namespace LLTrace
F64 getMax() const { return mMax; }
F64 getLastValue() const { return mLastValue; }
F64 getMean() const { return mMean; }
- F64 getStandardDeviation() const { return sqrtf(mVarianceSum / mNumSamples); }
+ F64 getStandardDeviation() const { return sqrtf(mSumOfSquares / mNumSamples); }
U32 getSampleCount() const { return mNumSamples; }
private:
@@ -319,7 +319,7 @@ namespace LLTrace
mLastValue;
F64 mMean,
- mVarianceSum;
+ mSumOfSquares;
U32 mNumSamples;
};
@@ -336,7 +336,7 @@ namespace LLTrace
mMin((std::numeric_limits<F64>::max)()),
mMax((std::numeric_limits<F64>::min)()),
mMean(0),
- mVarianceSum(0),
+ mSumOfSquares(0),
mLastSampleTimeStamp(LLTimer::getTotalSeconds()),
mTotalSamplingTime(0),
mNumSamples(0),
@@ -361,7 +361,7 @@ namespace LLTrace
F64 old_mean = mMean;
mMean += (delta_time / mTotalSamplingTime) * (mLastValue - old_mean);
- mVarianceSum += delta_time * (mLastValue - old_mean) * (mLastValue - mMean);
+ mSumOfSquares += delta_time * (mLastValue - old_mean) * (mLastValue - mMean);
}
mLastValue = value;
@@ -385,20 +385,20 @@ namespace LLTrace
n_2 = other.mTotalSamplingTime;
F64 m_1 = mMean,
m_2 = other.mMean;
- F64 v_1 = mVarianceSum / mTotalSamplingTime,
- v_2 = other.mVarianceSum / other.mTotalSamplingTime;
+ F64 v_1 = mSumOfSquares / mTotalSamplingTime,
+ v_2 = other.mSumOfSquares / other.mTotalSamplingTime;
if (n_1 == 0)
{
- mVarianceSum = other.mVarianceSum;
+ mSumOfSquares = other.mSumOfSquares;
}
else if (n_2 == 0)
{
// variance is unchanged
- // mVarianceSum = mVarianceSum;
+ // mSumOfSquares = mSumOfSquares;
}
else
{
- mVarianceSum = mTotalSamplingTime
+ mSumOfSquares = mTotalSamplingTime
* ((((n_1 - 1.f) * v_1)
+ ((n_2 - 1.f) * v_2)
+ (((n_1 * n_2) / (n_1 + n_2))
@@ -427,7 +427,7 @@ namespace LLTrace
mMin = std::numeric_limits<F64>::max();
mMax = std::numeric_limits<F64>::min();
mMean = other ? other->mLastValue : 0;
- mVarianceSum = 0;
+ mSumOfSquares = 0;
mLastSampleTimeStamp = LLTimer::getTotalSeconds();
mTotalSamplingTime = 0;
mLastValue = other ? other->mLastValue : 0;
@@ -451,7 +451,7 @@ namespace LLTrace
F64 getMax() const { return mMax; }
F64 getLastValue() const { return mLastValue; }
F64 getMean() const { return mMean; }
- F64 getStandardDeviation() const { return sqrtf(mVarianceSum / mTotalSamplingTime); }
+ F64 getStandardDeviation() const { return sqrtf(mSumOfSquares / mTotalSamplingTime); }
U32 getSampleCount() const { return mNumSamples; }
private:
@@ -463,7 +463,7 @@ namespace LLTrace
bool mHasValue;
F64 mMean,
- mVarianceSum;
+ mSumOfSquares;
LLUnitImplicit<F64, LLUnits::Seconds> mLastSampleTimeStamp,
mTotalSamplingTime;
diff --git a/indra/llcommon/llunit.h b/indra/llcommon/llunit.h
index f81e746c77..d6d8d9da6a 100644
--- a/indra/llcommon/llunit.h
+++ b/indra/llcommon/llunit.h
@@ -542,28 +542,28 @@ struct base_unit_name
}
-#define LL_DECLARE_DERIVED_UNIT(unit_name, unit_label, base_unit_name, conversion_operation) \
-struct unit_name \
-{ \
- typedef base_unit_name base_unit_t; \
- static const char* getUnitLabel() { return unit_label; } \
- template<typename T> \
- static LLUnit<T, unit_name> fromValue(T value) { return LLUnit<T, unit_name>(value); } \
- template<typename STORAGE_T, typename UNIT_T> \
- static LLUnit<STORAGE_T, unit_name> fromValue(LLUnit<STORAGE_T, UNIT_T> value) \
- { return LLUnit<STORAGE_T, unit_name>(value); } \
-}; \
- \
-template<typename S1, typename S2> \
-void ll_convert_units(LLUnit<S1, unit_name> in, LLUnit<S2, base_unit_name>& out) \
-{ \
- out = LLUnit<S2, base_unit_name>((S2)(LLUnitLinearOps<S1>(in.value()) conversion_operation)); \
-} \
- \
-template<typename S1, typename S2> \
-void ll_convert_units(LLUnit<S1, base_unit_name> in, LLUnit<S2, unit_name>& out) \
-{ \
- out = LLUnit<S2, unit_name>((S2)(LLUnitInverseLinearOps<S1>(in.value()) conversion_operation)); \
+#define LL_DECLARE_DERIVED_UNIT(base_unit_name, conversion_operation, unit_name, unit_label) \
+struct unit_name \
+{ \
+ typedef base_unit_name base_unit_t; \
+ static const char* getUnitLabel() { return unit_label; } \
+ template<typename T> \
+ static LLUnit<T, unit_name> fromValue(T value) { return LLUnit<T, unit_name>(value); } \
+ template<typename STORAGE_T, typename UNIT_T> \
+ static LLUnit<STORAGE_T, unit_name> fromValue(LLUnit<STORAGE_T, UNIT_T> value) \
+ { return LLUnit<STORAGE_T, unit_name>(value); } \
+}; \
+ \
+template<typename S1, typename S2> \
+void ll_convert_units(LLUnit<S1, unit_name> in, LLUnit<S2, base_unit_name>& out) \
+{ \
+ out = LLUnit<S2, base_unit_name>((S2)(LLUnitLinearOps<S1>(in.value()) conversion_operation)); \
+} \
+ \
+template<typename S1, typename S2> \
+void ll_convert_units(LLUnit<S1, base_unit_name> in, LLUnit<S2, unit_name>& out) \
+{ \
+ out = LLUnit<S2, unit_name>((S2)(LLUnitInverseLinearOps<S1>(in.value()) conversion_operation)); \
}
//
@@ -573,46 +573,46 @@ void ll_convert_units(LLUnit<S1, base_unit_name> in, LLUnit<S2, unit_name>& out)
namespace LLUnits
{
LL_DECLARE_BASE_UNIT(Bytes, "B");
-LL_DECLARE_DERIVED_UNIT(Kilobytes, "KB", Bytes, * 1000);
-LL_DECLARE_DERIVED_UNIT(Megabytes, "MB", Kilobytes, * 1000);
-LL_DECLARE_DERIVED_UNIT(Gigabytes, "GB", Megabytes, * 1000);
-LL_DECLARE_DERIVED_UNIT(Kibibytes, "KiB", Bytes, * 1024);
-LL_DECLARE_DERIVED_UNIT(Mibibytes, "MiB", Kibibytes, * 1024);
-LL_DECLARE_DERIVED_UNIT(Gibibytes, "GiB", Mibibytes, * 1024);
-
-LL_DECLARE_DERIVED_UNIT(Bits, "b", Bytes, / 8);
-LL_DECLARE_DERIVED_UNIT(Kilobits, "Kb", Bytes, * 1000 / 8);
-LL_DECLARE_DERIVED_UNIT(Megabits, "Mb", Kilobits, * 1000 / 8);
-LL_DECLARE_DERIVED_UNIT(Gigabits, "Gb", Megabits, * 1000 / 8);
-LL_DECLARE_DERIVED_UNIT(Kibibits, "Kib", Bytes, * 1024 / 8);
-LL_DECLARE_DERIVED_UNIT(Mibibits, "Mib", Kibibits, * 1024 / 8);
-LL_DECLARE_DERIVED_UNIT(Gibibits, "Gib", Mibibits, * 1024 / 8);
+LL_DECLARE_DERIVED_UNIT(Bytes, * 1000, Kilobytes, "KB");
+LL_DECLARE_DERIVED_UNIT(Kilobytes, * 1000, Megabytes, "MB");
+LL_DECLARE_DERIVED_UNIT(Megabytes, * 1000, Gigabytes, "GB");
+LL_DECLARE_DERIVED_UNIT(Bytes, * 1024, Kibibytes, "KiB");
+LL_DECLARE_DERIVED_UNIT(Kibibytes, * 1024, Mibibytes, "MiB");
+LL_DECLARE_DERIVED_UNIT(Mibibytes, * 1024, Gibibytes, "GiB");
+
+LL_DECLARE_DERIVED_UNIT(Bytes, / 8, Bits, "b");
+LL_DECLARE_DERIVED_UNIT(Bits, * 1000, Kilobits, "Kb");
+LL_DECLARE_DERIVED_UNIT(Kilobits, * 1000, Megabits, "Mb");
+LL_DECLARE_DERIVED_UNIT(Megabits, * 1000, Gigabits, "Gb");
+LL_DECLARE_DERIVED_UNIT(Bits, * 1024, Kibibits, "Kib");
+LL_DECLARE_DERIVED_UNIT(Kibibits, * 1024, Mibibits, "Mib");
+LL_DECLARE_DERIVED_UNIT(Mibibits, * 1024, Gibibits, "Gib");
LL_DECLARE_BASE_UNIT(Seconds, "s");
-LL_DECLARE_DERIVED_UNIT(Minutes, "min", Seconds, * 60);
-LL_DECLARE_DERIVED_UNIT(Hours, "h", Seconds, * 60 * 60);
-LL_DECLARE_DERIVED_UNIT(Milliseconds, "ms", Seconds, / 1000);
-LL_DECLARE_DERIVED_UNIT(Microseconds, "\x09\x3cs", Milliseconds, / 1000);
-LL_DECLARE_DERIVED_UNIT(Nanoseconds, "ns", Microseconds, / 1000);
+LL_DECLARE_DERIVED_UNIT(Seconds, * 60, Minutes, "min");
+LL_DECLARE_DERIVED_UNIT(Minutes, * 60, Hours, "h");
+LL_DECLARE_DERIVED_UNIT(Seconds, / 1000, Milliseconds, "ms");
+LL_DECLARE_DERIVED_UNIT(Milliseconds, / 1000, Microseconds, "\x09\x3cs");
+LL_DECLARE_DERIVED_UNIT(Microseconds, / 1000, Nanoseconds, "ns");
LL_DECLARE_BASE_UNIT(Meters, "m");
-LL_DECLARE_DERIVED_UNIT(Kilometers, "km", Meters, * 1000);
-LL_DECLARE_DERIVED_UNIT(Centimeters, "cm", Meters, / 100);
-LL_DECLARE_DERIVED_UNIT(Millimeters, "mm", Meters, / 1000);
+LL_DECLARE_DERIVED_UNIT(Meters, * 1000, Kilometers, "km");
+LL_DECLARE_DERIVED_UNIT(Meters, / 100, Centimeters, "cm");
+LL_DECLARE_DERIVED_UNIT(Meters, / 1000, Millimeters, "mm");
LL_DECLARE_BASE_UNIT(Hertz, "Hz");
-LL_DECLARE_DERIVED_UNIT(Kilohertz, "KHz", Hertz, * 1000);
-LL_DECLARE_DERIVED_UNIT(Megahertz, "MHz", Kilohertz, * 1000);
-LL_DECLARE_DERIVED_UNIT(Gigahertz, "GHz", Megahertz, * 1000);
+LL_DECLARE_DERIVED_UNIT(Hertz, * 1000, Kilohertz, "KHz");
+LL_DECLARE_DERIVED_UNIT(Kilohertz, * 1000, Megahertz, "MHz");
+LL_DECLARE_DERIVED_UNIT(Megahertz, * 1000, Gigahertz, "GHz");
LL_DECLARE_BASE_UNIT(Radians, "rad");
-LL_DECLARE_DERIVED_UNIT(Degrees, "deg", Radians, * 0.01745329251994);
+LL_DECLARE_DERIVED_UNIT(Radians, / 57.29578f, Degrees, "deg");
LL_DECLARE_BASE_UNIT(Percent, "%");
-LL_DECLARE_DERIVED_UNIT(Ratio, "x", Percent, / 100);
+LL_DECLARE_DERIVED_UNIT(Percent, * 100, Ratio, "x");
LL_DECLARE_BASE_UNIT(Triangles, "tris");
-LL_DECLARE_DERIVED_UNIT(Kilotriangles, "ktris", Triangles, * 1000);
+LL_DECLARE_DERIVED_UNIT(Triangles, * 1000, Kilotriangles, "ktris");
} // namespace LLUnits
diff --git a/indra/llmath/llmath.h b/indra/llmath/llmath.h
index cad2461e9c..eeb5cd3ee6 100755
--- a/indra/llmath/llmath.h
+++ b/indra/llmath/llmath.h
@@ -113,6 +113,12 @@ inline bool is_approx_zero( F32 f ) { return (-F_APPROXIMATELY_ZERO < f) && (f <
// WARNING: Infinity is comparable with F32_MAX and negative
// infinity is comparable with F32_MIN
+// handles negative and positive zeros
+inline bool is_zero(F32 x)
+{
+ return (*(U32*)(&x) & 0x7fffffff) == 0;
+}
+
inline bool is_approx_equal(F32 x, F32 y)
{
const S32 COMPARE_MANTISSA_UP_TO_BIT = 0x02;
diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp
index 94f06eb1d0..aadbbbacbb 100755
--- a/indra/newview/llface.cpp
+++ b/indra/newview/llface.cpp
@@ -819,14 +819,14 @@ BOOL LLFace::genVolumeBBoxes(const LLVolume &volume, S32 f,
// Catch potential badness from normalization before it happens
//
- llassert(mat_normal.mMatrix[0].isFinite3() && (mat_normal.mMatrix[0].dot3(mat_normal.mMatrix[0]).getF32() > F_APPROXIMATELY_ZERO));
- llassert(mat_normal.mMatrix[1].isFinite3() && (mat_normal.mMatrix[1].dot3(mat_normal.mMatrix[1]).getF32() > F_APPROXIMATELY_ZERO));
- llassert(mat_normal.mMatrix[2].isFinite3() && (mat_normal.mMatrix[2].dot3(mat_normal.mMatrix[2]).getF32() > F_APPROXIMATELY_ZERO));
-
mat_normal.mMatrix[0].normalize3fast();
mat_normal.mMatrix[1].normalize3fast();
mat_normal.mMatrix[2].normalize3fast();
-
+
+ llassert(mat_normal.mMatrix[0].isFinite3());
+ llassert(mat_normal.mMatrix[1].isFinite3());
+ llassert(mat_normal.mMatrix[2].isFinite3());
+
LLVector4a v[4];
//get 4 corners of bounding box
diff --git a/indra/newview/llfasttimerview.cpp b/indra/newview/llfasttimerview.cpp
index d922659435..b61889ccfa 100755
--- a/indra/newview/llfasttimerview.cpp
+++ b/indra/newview/llfasttimerview.cpp
@@ -1338,7 +1338,7 @@ void LLFastTimerView::drawHelp( S32 y )
y -= (texth + 2);
y -= (texth + 2);
- LLFontGL::getFontMonospace()->renderUTF8(std::string("[Right-Click log selected] [ALT-Click toggle counts]"),
+ LLFontGL::getFontMonospace()->renderUTF8(std::string("[Right-Click log selected]"),
0, MARGIN, y, LLColor4::white, LLFontGL::LEFT, LLFontGL::TOP);
}