From f45b809bd7f0b9afb4d530ec0acb2d06eaafe41b Mon Sep 17 00:00:00 2001 From: callum_linden Date: Fri, 17 Oct 2014 12:39:09 -0700 Subject: Update to build on Xcode 6.0: reorder code and additional scoing in template classes to make clang happy --- indra/llcommon/llunittype.h | 92 +++++++++++++++++++++++---------------------- 1 file changed, 47 insertions(+), 45 deletions(-) (limited to 'indra') diff --git a/indra/llcommon/llunittype.h b/indra/llcommon/llunittype.h index 0e05ecd683..ac8504ca61 100644 --- a/indra/llcommon/llunittype.h +++ b/indra/llcommon/llunittype.h @@ -87,6 +87,40 @@ struct LLUnit : mValue(value) {} + + LL_FORCE_INLINE static self_t convert(self_t v) + { + return v; + } + + template + LL_FORCE_INLINE static self_t convert(LLUnit v) + { + self_t result; + result.mValue = (STORAGE_TYPE)v.value(); + return result; + } + + template + LL_FORCE_INLINE static self_t convert(LLUnit v) + { + self_t result; + STORAGE_TYPE divisor = ll_convert_units(v, result); + result.mValue /= divisor; + return result; + } + + template + LL_FORCE_INLINE static self_t convert(LLUnit v) + { + typedef typename LLResultTypePromote::type_t result_storage_t; + LLUnit result; + result_storage_t divisor = ll_convert_units(v, result); + result.value(result.value() / divisor); + return self_t(result.value()); + } + + // unit initialization and conversion template LL_FORCE_INLINE LLUnit(LLUnit other) @@ -183,38 +217,6 @@ struct LLUnit return mValue >= convert(other).value(); } - LL_FORCE_INLINE static self_t convert(self_t v) - { - return v; - } - - template - LL_FORCE_INLINE static self_t convert(LLUnit v) - { - self_t result; - result.mValue = (STORAGE_TYPE)v.value(); - return result; - } - - template - LL_FORCE_INLINE static self_t convert(LLUnit v) - { - self_t result; - STORAGE_TYPE divisor = ll_convert_units(v, result); - result.mValue /= divisor; - return result; - } - - template - LL_FORCE_INLINE static self_t convert(LLUnit v) - { - typedef typename LLResultTypePromote::type_t result_storage_t; - LLUnit result; - result_storage_t divisor = ll_convert_units(v, result); - result.value(result.value() / divisor); - return self_t(result.value()); - } - protected: storage_t mValue; }; @@ -269,7 +271,7 @@ struct LLUnitImplicit : public LLUnit template LL_FORCE_INLINE void operator += (LLUnitImplicit other) { - base_t::mValue += convert(other).value(); + base_t::mValue += base_t::convert(other).value(); } using base_t::operator -=; @@ -283,19 +285,19 @@ struct LLUnitImplicit : public LLUnit template LL_FORCE_INLINE void operator -= (LLUnitImplicit other) { - base_t::mValue -= convert(other).value(); + base_t::mValue -= base_t::convert(other).value(); } template LL_FORCE_INLINE bool operator == (LLUnit other) const { - return base_t::mValue == convert(other).value(); + return base_t::mValue == base_t::convert(other).value(); } template LL_FORCE_INLINE bool operator == (LLUnitImplicit other) const { - return base_t::mValue == convert(other).value(); + return base_t::mValue == base_t::convert(other).value(); } template @@ -313,7 +315,7 @@ struct LLUnitImplicit : public LLUnit template LL_FORCE_INLINE bool operator != (LLUnitImplicit other) const { - return base_t::mValue != convert(other).value(); + return base_t::mValue != base_t::convert(other).value(); } template @@ -325,13 +327,13 @@ struct LLUnitImplicit : public LLUnit template LL_FORCE_INLINE bool operator < (LLUnit other) const { - return base_t::mValue < convert(other).value(); + return base_t::mValue < base_t::convert(other).value(); } template LL_FORCE_INLINE bool operator < (LLUnitImplicit other) const { - return base_t::mValue < convert(other).value(); + return base_t::mValue < base_t::convert(other).value(); } template @@ -343,13 +345,13 @@ struct LLUnitImplicit : public LLUnit template LL_FORCE_INLINE bool operator <= (LLUnit other) const { - return base_t::mValue <= convert(other).value(); + return base_t::mValue <= base_t::convert(other).value(); } template LL_FORCE_INLINE bool operator <= (LLUnitImplicit other) const { - return base_t::mValue <= convert(other).value(); + return base_t::mValue <= base_t::convert(other).value(); } template @@ -361,13 +363,13 @@ struct LLUnitImplicit : public LLUnit template LL_FORCE_INLINE bool operator > (LLUnit other) const { - return base_t::mValue > convert(other).value(); + return base_t::mValue > base_t::convert(other).value(); } template LL_FORCE_INLINE bool operator > (LLUnitImplicit other) const { - return base_t::mValue > convert(other).value(); + return base_t::mValue > base_t::convert(other).value(); } template @@ -379,13 +381,13 @@ struct LLUnitImplicit : public LLUnit template LL_FORCE_INLINE bool operator >= (LLUnit other) const { - return base_t::mValue >= convert(other).value(); + return base_t::mValue >= base_t::convert(other).value(); } template LL_FORCE_INLINE bool operator >= (LLUnitImplicit other) const { - return base_t::mValue >= convert(other).value(); + return base_t::mValue >= base_t::convert(other).value(); } template -- cgit v1.2.3