summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorRichard Linden <none@none>2013-08-27 18:08:52 -0700
committerRichard Linden <none@none>2013-08-27 18:08:52 -0700
commit1f58bcc59cb61e041db1964ee12ce7c7d4aa36fa (patch)
treeaf257f80f8ac5b1fa3b1d7b2261bb6ada0fd2d04 /indra
parent35e8c81dd8afd05b6298a1849c63bc9238ab3271 (diff)
parent25e2fbe419655b2f8ce22dbafa1de6bc655b1567 (diff)
Automated merge with http://bitbucket.org/lindenlab/viewer-interesting
Diffstat (limited to 'indra')
-rw-r--r--indra/llcommon/llunittype.h44
-rw-r--r--indra/llcommon/tests/llunits_test.cpp10
2 files changed, 48 insertions, 6 deletions
diff --git a/indra/llcommon/llunittype.h b/indra/llcommon/llunittype.h
index 5cf41343fc..fbb8eb2431 100644
--- a/indra/llcommon/llunittype.h
+++ b/indra/llcommon/llunittype.h
@@ -169,11 +169,13 @@ struct LLUnit
{
return mValue <= convert(other).value();
}
+
template<typename OTHER_STORAGE_TYPE, typename OTHER_UNITS>
LL_FORCE_INLINE bool operator > (LLUnit<OTHER_STORAGE_TYPE, OTHER_UNITS> other) const
{
return mValue > convert(other).value();
}
+
template<typename OTHER_STORAGE_TYPE, typename OTHER_UNITS>
LL_FORCE_INLINE bool operator >= (LLUnit<OTHER_STORAGE_TYPE, OTHER_UNITS> other) const
{
@@ -283,7 +285,12 @@ struct LLUnitImplicit : public LLUnit<STORAGE_TYPE, UNITS>
base_t::mValue -= convert(other).value();
}
- using base_t::operator ==;
+ template<typename OTHER_STORAGE_TYPE, typename OTHER_UNITS>
+ LL_FORCE_INLINE bool operator == (LLUnit<OTHER_STORAGE_TYPE, OTHER_UNITS> other) const
+ {
+ return mValue == convert(other).value();
+ }
+
template<typename OTHER_STORAGE_TYPE, typename OTHER_UNITS>
LL_FORCE_INLINE bool operator == (LLUnitImplicit<OTHER_STORAGE_TYPE, OTHER_UNITS> other) const
{
@@ -296,7 +303,12 @@ struct LLUnitImplicit : public LLUnit<STORAGE_TYPE, UNITS>
return base_t::mValue == other;
}
- using base_t::operator !=;
+ template<typename OTHER_STORAGE_TYPE, typename OTHER_UNITS>
+ LL_FORCE_INLINE bool operator != (LLUnit<OTHER_STORAGE_TYPE, OTHER_UNITS> other) const
+ {
+ return mValue != convert(other).value();
+ }
+
template<typename OTHER_STORAGE_TYPE, typename OTHER_UNITS>
LL_FORCE_INLINE bool operator != (LLUnitImplicit<OTHER_STORAGE_TYPE, OTHER_UNITS> other) const
{
@@ -309,7 +321,12 @@ struct LLUnitImplicit : public LLUnit<STORAGE_TYPE, UNITS>
return base_t::mValue != other;
}
- using base_t::operator <;
+ template<typename OTHER_STORAGE_TYPE, typename OTHER_UNITS>
+ LL_FORCE_INLINE bool operator < (LLUnit<OTHER_STORAGE_TYPE, OTHER_UNITS> other) const
+ {
+ return mValue < convert(other).value();
+ }
+
template<typename OTHER_STORAGE_TYPE, typename OTHER_UNITS>
LL_FORCE_INLINE bool operator < (LLUnitImplicit<OTHER_STORAGE_TYPE, OTHER_UNITS> other) const
{
@@ -322,7 +339,12 @@ struct LLUnitImplicit : public LLUnit<STORAGE_TYPE, UNITS>
return base_t::mValue < other;
}
- using base_t::operator <=;
+ template<typename OTHER_STORAGE_TYPE, typename OTHER_UNITS>
+ LL_FORCE_INLINE bool operator <= (LLUnit<OTHER_STORAGE_TYPE, OTHER_UNITS> other) const
+ {
+ return mValue <= convert(other).value();
+ }
+
template<typename OTHER_STORAGE_TYPE, typename OTHER_UNITS>
LL_FORCE_INLINE bool operator <= (LLUnitImplicit<OTHER_STORAGE_TYPE, OTHER_UNITS> other) const
{
@@ -335,7 +357,12 @@ struct LLUnitImplicit : public LLUnit<STORAGE_TYPE, UNITS>
return base_t::mValue <= other;
}
- using base_t::operator >;
+ template<typename OTHER_STORAGE_TYPE, typename OTHER_UNITS>
+ LL_FORCE_INLINE bool operator > (LLUnit<OTHER_STORAGE_TYPE, OTHER_UNITS> other) const
+ {
+ return mValue > convert(other).value();
+ }
+
template<typename OTHER_STORAGE_TYPE, typename OTHER_UNITS>
LL_FORCE_INLINE bool operator > (LLUnitImplicit<OTHER_STORAGE_TYPE, OTHER_UNITS> other) const
{
@@ -348,7 +375,12 @@ struct LLUnitImplicit : public LLUnit<STORAGE_TYPE, UNITS>
return base_t::mValue > other;
}
- using base_t::operator >=;
+ template<typename OTHER_STORAGE_TYPE, typename OTHER_UNITS>
+ LL_FORCE_INLINE bool operator >= (LLUnit<OTHER_STORAGE_TYPE, OTHER_UNITS> other) const
+ {
+ return mValue >= convert(other).value();
+ }
+
template<typename OTHER_STORAGE_TYPE, typename OTHER_UNITS>
LL_FORCE_INLINE bool operator >= (LLUnitImplicit<OTHER_STORAGE_TYPE, OTHER_UNITS> other) const
{
diff --git a/indra/llcommon/tests/llunits_test.cpp b/indra/llcommon/tests/llunits_test.cpp
index 59876ce3b4..d5b7c08672 100644
--- a/indra/llcommon/tests/llunits_test.cpp
+++ b/indra/llcommon/tests/llunits_test.cpp
@@ -274,6 +274,16 @@ namespace tut
quatloos_implicit -= F32Quatloos(10);
ensure("can subtract-assign explicit units", quatloos_implicit == 16);
+
+ // comparisons
+ ensure("can compare greater than implicit unit", quatloos_implicit > F32QuatloosImplicit(0.f));
+ ensure("can compare greater than non-implicit unit", quatloos_implicit > F32Quatloos(0.f));
+ ensure("can compare greater than or equal to implicit unit", quatloos_implicit >= F32QuatloosImplicit(0.f));
+ ensure("can compare greater than or equal to non-implicit unit", quatloos_implicit >= F32Quatloos(0.f));
+ ensure("can compare less than implicit unit", quatloos_implicit < F32QuatloosImplicit(0.f));
+ ensure("can compare less than non-implicit unit", quatloos_implicit < F32Quatloos(0.f));
+ ensure("can compare less than or equal to implicit unit", quatloos_implicit <= F32QuatloosImplicit(0.f));
+ ensure("can compare less than or equal to non-implicit unit", quatloos_implicit <= F32Quatloos(0.f));
}
// precision tests