From 9c256611f1814b843e1adc29f8a9185a3519eeaf Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 19 Aug 2013 16:05:03 -0700 Subject: BUILDFIX: removed consideration of some bad overloads in return type evaluation of unit operators --- indra/llcommon/llunit.h | 587 +++++++++++------------------------------------- 1 file changed, 128 insertions(+), 459 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llunit.h b/indra/llcommon/llunit.h index 67810ffabc..8fb53dd94d 100644 --- a/indra/llcommon/llunit.h +++ b/indra/llcommon/llunit.h @@ -46,12 +46,27 @@ struct LLIsSameType // workaround for decltype() not existing and typeof() not working inline in gcc 4.2 template -struct LLResultType +struct LLResultTypeAdd { - typedef LL_TYPEOF(S() + T()) add_t; - typedef LL_TYPEOF(S() - T()) subtract_t; - typedef LL_TYPEOF(S() * T()) multiply_t; - typedef LL_TYPEOF(S() / T(1)) divide_t; + typedef LL_TYPEOF(S() + T()) type_t; +}; + +template +struct LLResultTypeSubtract +{ + typedef LL_TYPEOF(S() - T()) type_t; +}; + +template +struct LLResultTypeMultiply +{ + typedef LL_TYPEOF(S() * T()) type_t; +}; + +template +struct LLResultTypeDivide +{ + typedef LL_TYPEOF(S() / T(1)) type_t; }; template @@ -262,13 +277,25 @@ LL_FORCE_INLINE void ll_convert_units(LLUnit in, LLUnit& out, .. } } +template +struct LLStorageType +{ + typedef T type_t; +}; + +template +struct LLStorageType > +{ + typedef STORAGE_TYPE type_t; +}; + // // operator + // template -LLUnit::add_t, UNIT_TYPE1> operator + (LLUnit first, LLUnit second) +LLUnit::type_t, UNIT_TYPE1> operator + (LLUnit first, LLUnit second) { - LLUnit::add_t, UNIT_TYPE1> result(first); + LLUnit::type_t, UNIT_TYPE1> result(first); result += second; return result; } @@ -288,41 +315,42 @@ LLUnit operator + (UNITLESS first, LLUnit -LLUnitImplicit::add_t, UNIT_TYPE1> operator + (LLUnitImplicit first, LLUnitImplicit second) +LLUnitImplicit::type_t, UNIT_TYPE1> operator + (LLUnitImplicit first, LLUnitImplicit second) { - LLUnitImplicit::add_t, UNIT_TYPE1> result(first); + LLUnitImplicit::type_t, UNIT_TYPE1> result(first); result += second; return result; } template -LLUnitImplicit::add_t, UNIT_TYPE1> operator + (LLUnit first, LLUnitImplicit second) +LLUnitImplicit::type_t, UNIT_TYPE1> operator + (LLUnit first, LLUnitImplicit second) { - LLUnitImplicit::add_t, UNIT_TYPE1> result(first); + LLUnitImplicit::type_t, UNIT_TYPE1> result(first); result += second; return result; } template -LLUnitImplicit::add_t, UNIT_TYPE1> operator + (LLUnitImplicit first, LLUnit second) +LLUnitImplicit::type_t, UNIT_TYPE1> operator + (LLUnitImplicit first, LLUnit second) { - LLUnitImplicit::add_t, UNIT_TYPE1> result(first); + LLUnitImplicit::type_t, UNIT_TYPE1> result(first); result += LLUnitImplicit(second); return result; } template -LLUnitImplicit::add_t, UNIT_TYPE> operator + (LLUnitImplicit first, UNITLESS_TYPE second) +LLUnitImplicit::type_t>::type_t, UNIT_TYPE> operator + (LLUnitImplicit first, UNITLESS_TYPE second) { - LLUnitImplicit::add_t, UNIT_TYPE> result(first); + LLUnitImplicit::type_t>::type_t, UNIT_TYPE> result(first); result += second; return result; } template -LLUnitImplicit::add_t, UNIT_TYPE> operator + (UNITLESS_TYPE first, LLUnitImplicit second) +LLUnitImplicit::type_t, STORAGE_TYPE>:: + type_t, UNIT_TYPE> operator + (UNITLESS_TYPE first, LLUnitImplicit second) { - LLUnitImplicit::add_t, UNIT_TYPE> result(first); + LLUnitImplicit::type_t, STORAGE_TYPE>::type_t, UNIT_TYPE> result(first); result += second; return result; } @@ -331,9 +359,9 @@ LLUnitImplicit::add_t, UNIT_T // operator - // template -LLUnit::subtract_t, UNIT_TYPE1> operator - (LLUnit first, LLUnit second) +LLUnit::type_t, UNIT_TYPE1> operator - (LLUnit first, LLUnit second) { - LLUnit::subtract_t, UNIT_TYPE1> result(first); + LLUnit::type_t, UNIT_TYPE1> result(first); result -= second; return result; } @@ -353,41 +381,41 @@ LLUnit operator - (UNITLESS first, LLUnit -LLUnitImplicit::subtract_t, UNIT_TYPE1> operator - (LLUnitImplicit first, LLUnitImplicit second) +LLUnitImplicit::type_t, UNIT_TYPE1> operator - (LLUnitImplicit first, LLUnitImplicit second) { - LLUnitImplicit::subtract_t, UNIT_TYPE1> result(first); + LLUnitImplicit::type_t, UNIT_TYPE1> result(first); result -= second; return result; } template -LLUnitImplicit::subtract_t, UNIT_TYPE1> operator - (LLUnit first, LLUnitImplicit second) +LLUnitImplicit::type_t, UNIT_TYPE1> operator - (LLUnit first, LLUnitImplicit second) { - LLUnitImplicit::subtract_t, UNIT_TYPE1> result(first); + LLUnitImplicit::type_t, UNIT_TYPE1> result(first); result -= second; return result; } template -LLUnitImplicit::subtract_t, UNIT_TYPE1> operator - (LLUnitImplicit first, LLUnit second) +LLUnitImplicit::type_t, UNIT_TYPE1> operator - (LLUnitImplicit first, LLUnit second) { - LLUnitImplicit::subtract_t, UNIT_TYPE1> result(first); + LLUnitImplicit::type_t, UNIT_TYPE1> result(first); result -= LLUnitImplicit(second); return result; } template -LLUnitImplicit::subtract_t, UNIT_TYPE> operator - (LLUnitImplicit first, UNITLESS_TYPE second) +LLUnitImplicit::type_t>::type_t, UNIT_TYPE> operator - (LLUnitImplicit first, UNITLESS_TYPE second) { - LLUnitImplicit::subtract_t, UNIT_TYPE> result(first); + LLUnitImplicit::type_t>::type_t, UNIT_TYPE> result(first); result -= second; return result; } template -LLUnitImplicit::subtract_t, UNIT_TYPE> operator - (UNITLESS_TYPE first, LLUnitImplicit second) +LLUnitImplicit::type_t, STORAGE_TYPE>::type_t, UNIT_TYPE> operator - (UNITLESS_TYPE first, LLUnitImplicit second) { - LLUnitImplicit::subtract_t, UNIT_TYPE> result(first); + LLUnitImplicit::type_t, STORAGE_TYPE>::type_t, UNIT_TYPE> result(first); result -= second; return result; } @@ -404,15 +432,15 @@ LLUnit operator * (LLUnit, } template -LLUnit::multiply_t, UNIT_TYPE> operator * (LLUnit first, UNITLESS_TYPE second) +LLUnit::type_t>::type_t, UNIT_TYPE> operator * (LLUnit first, UNITLESS_TYPE second) { - return LLUnit::multiply_t, UNIT_TYPE>(first.value() * second); + return LLUnit::type_t>::type_t, UNIT_TYPE>(first.value() * second); } template -LLUnit::multiply_t, UNIT_TYPE> operator * (UNITLESS_TYPE first, LLUnit second) +LLUnit::type_t, STORAGE_TYPE>::type_t, UNIT_TYPE> operator * (UNITLESS_TYPE first, LLUnit second) { - return LLUnit::multiply_t, UNIT_TYPE>(first * second.value()); + return LLUnit::type_t, STORAGE_TYPE>::type_t, UNIT_TYPE>(first * second.value()); } template @@ -424,15 +452,15 @@ LLUnitImplicit operator * (LLUnitImplicit -LLUnitImplicit::multiply_t, UNIT_TYPE> operator * (LLUnitImplicit first, UNITLESS_TYPE second) +LLUnitImplicit::type_t>::type_t, UNIT_TYPE> operator * (LLUnitImplicit first, UNITLESS_TYPE second) { - return LLUnitImplicit::multiply_t, UNIT_TYPE>(first.value() * second); + return LLUnitImplicit::type_t, UNIT_TYPE>(first.value() * second); } template -LLUnitImplicit::multiply_t, UNIT_TYPE> operator * (UNITLESS_TYPE first, LLUnitImplicit second) +LLUnitImplicit::type_t, STORAGE_TYPE>::type_t, UNIT_TYPE> operator * (UNITLESS_TYPE first, LLUnitImplicit second) { - return LLUnitImplicit::multiply_t, UNIT_TYPE>(first * second.value()); + return LLUnitImplicit::type_t, STORAGE_TYPE>::type_t, UNIT_TYPE>(first * second.value()); } @@ -441,39 +469,39 @@ LLUnitImplicit::multiply_t, U // template -LLUnit::divide_t, UNIT_TYPE> operator / (LLUnit first, UNITLESS_TYPE second) +LLUnit::type_t>::type_t, UNIT_TYPE> operator / (LLUnit first, UNITLESS_TYPE second) { - return LLUnit::divide_t, UNIT_TYPE>(first.value() / second); + return LLUnit::type_t>::type_t, UNIT_TYPE>(first.value() / second); } template -typename LLResultType::divide_t operator / (LLUnit first, LLUnit second) +typename LLResultTypeDivide::type_t operator / (LLUnit first, LLUnit second) { return first.value() / first.convert(second).value(); } template -LLUnitImplicit::divide_t, UNIT_TYPE> operator / (LLUnitImplicit first, UNITLESS_TYPE second) +LLUnitImplicit::type_t>::type_t, UNIT_TYPE> operator / (LLUnitImplicit first, UNITLESS_TYPE second) { - return LLUnitImplicit::divide_t, UNIT_TYPE>(first.value() / second); + return LLUnitImplicit::type_t>::type_t, UNIT_TYPE>(first.value() / second); } template -typename LLResultType::divide_t operator / (LLUnitImplicit first, LLUnitImplicit second) +typename LLResultTypeDivide::type_t operator / (LLUnitImplicit first, LLUnitImplicit second) { - return (typename LLResultType::divide_t)(first.value() / first.convert(second).value()); + return (typename LLResultTypeDivide::type_t)(first.value() / first.convert(second).value()); } template -typename LLResultType::divide_t operator / (LLUnit first, LLUnitImplicit second) +typename LLResultTypeDivide::type_t operator / (LLUnit first, LLUnitImplicit second) { - return (typename LLResultType::divide_t)(first.value() / first.convert(second).value()); + return (typename LLResultTypeDivide::type_t)(first.value() / first.convert(second).value()); } template -typename LLResultType::divide_t operator / (LLUnitImplicit first, LLUnit second) +typename LLResultTypeDivide::type_t operator / (LLUnitImplicit first, LLUnit second) { - return (typename LLResultType::divide_t)(first.value() / first.convert(second).value()); + return (typename LLResultTypeDivide::type_t)(first.value() / first.convert(second).value()); } // @@ -566,25 +594,25 @@ struct LLUnitLinearOps template output_t operator * (T other) { - return typename LLResultType::multiply_t(mInput) * other; + return typename LLResultTypeMultiply::type_t(mInput) * other; } template output_t operator / (T other) { - return typename LLResultType::divide_t(mInput) / other; + return typename LLResultTypeDivide::type_t(mInput) / other; } template output_t operator + (T other) { - return typename LLResultType::add_t(mInput) + other; + return typename LLResultTypeAdd::type_t(mInput) + other; } template output_t operator - (T other) { - return typename LLResultType::subtract_t(mInput) - other; + return typename LLResultTypeSubtract::type_t(mInput) - other; } }; @@ -603,25 +631,25 @@ struct LLUnitInverseLinearOps template output_t operator * (T other) { - return typename LLResultType::divide_t(mInput) / other; + return typename LLResultTypeDivide::type_t(mInput) / other; } template output_t operator / (T other) { - return typename LLResultType::multiply_t(mInput) * other; + return typename LLResultTypeMultiply::type_t(mInput) * other; } template output_t operator + (T other) { - return typename LLResultType::subtract_t(mInput) - other; + return typename LLResultTypeAdd::type_t(mInput) - other; } template output_t operator - (T other) { - return typename LLResultType::add_t(mInput) + other; + return typename LLResultTypeSubtract::type_t(mInput) + other; } }; @@ -662,6 +690,20 @@ void ll_convert_units(LLUnit in, LLUnit& out) out = LLUnit((S2)(LLUnitInverseLinearOps(in.value()) conversion_operation)); \ } +#define LL_DECLARE_UNIT_TYPEDEFS(ns, unit_name) \ + typedef LLUnit F32##unit_name; \ + typedef LLUnitImplicit F32##unit_name##Implicit;\ + typedef LLUnit F64##unit_name; \ + typedef LLUnitImplicit F64##unit_name##Implicit;\ + typedef LLUnit S32##unit_name; \ + typedef LLUnitImplicit S32##unit_name##Implicit;\ + typedef LLUnit S64##unit_name; \ + typedef LLUnitImplicit S64##unit_name##Implicit;\ + typedef LLUnit U32##unit_name; \ + typedef LLUnitImplicit U32##unit_name##Implicit;\ + typedef LLUnit U64##unit_name; \ + typedef LLUnitImplicit U64##unit_name##Implicit + // // Unit declarations // @@ -675,65 +717,10 @@ LL_DECLARE_DERIVED_UNIT(Kilobytes, * 1024, Megabytes, "MB"); LL_DECLARE_DERIVED_UNIT(Megabytes, * 1024, Gigabytes, "GB"); } -typedef LLUnit F32Bytes; -typedef LLUnit F32Kilobytes; -typedef LLUnit F32Megabytes; -typedef LLUnit F32Gigabytes; - -typedef LLUnitImplicit F32BytesImplicit; -typedef LLUnitImplicit F32KilobytesImplicit; -typedef LLUnitImplicit F32MegabytesImplicit; -typedef LLUnitImplicit F32GigabytesImplicit; - -typedef LLUnit F64Bytes; -typedef LLUnit F64Kilobytes; -typedef LLUnit F64Megabytes; -typedef LLUnit F64Gigabytes; - -typedef LLUnitImplicit F64BytesImplicit; -typedef LLUnitImplicit F64KilobytesImplicit; -typedef LLUnitImplicit F64MegabytesImplicit; -typedef LLUnitImplicit F64GigabytesImplicit; - -typedef LLUnit S32Bytes; -typedef LLUnit S32Kilobytes; -typedef LLUnit S32Megabytes; -typedef LLUnit S32Gigabytes; - -typedef LLUnitImplicit S32BytesImplicit; -typedef LLUnitImplicit S32KilobytesImplicit; -typedef LLUnitImplicit S32MegabytesImplicit; -typedef LLUnitImplicit S32GigabytesImplicit; - -typedef LLUnit S64Bytes; -typedef LLUnit S64Kilobytes; -typedef LLUnit S64Megabytes; -typedef LLUnit S64Gigabytes; - -typedef LLUnitImplicit S64BytesImplicit; -typedef LLUnitImplicit S64KilobytesImplicit; -typedef LLUnitImplicit S64MegabytesImplicit; -typedef LLUnitImplicit S64GigabytesImplicit; - -typedef LLUnit U32Bytes; -typedef LLUnit U32Kilobytes; -typedef LLUnit U32Megabytes; -typedef LLUnit U32Gigabytes; - -typedef LLUnitImplicit U32BytesImplicit; -typedef LLUnitImplicit U32KilobytesImplicit; -typedef LLUnitImplicit U32MegabytesImplicit; -typedef LLUnitImplicit U32GigabytesImplicit; - -typedef LLUnit U64Bytes; -typedef LLUnit U64Kilobytes; -typedef LLUnit U64Megabytes; -typedef LLUnit U64Gigabytes; - -typedef LLUnitImplicit U64BytesImplicit; -typedef LLUnitImplicit U64KilobytesImplicit; -typedef LLUnitImplicit U64MegabytesImplicit; -typedef LLUnitImplicit U64GigabytesImplicit; +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Bytes); +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Kilobytes); +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Megabytes); +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Gigabytes); namespace LLUnits { @@ -744,65 +731,10 @@ LL_DECLARE_DERIVED_UNIT(Kilobits, * 1024, Megabits, "Mb"); LL_DECLARE_DERIVED_UNIT(Megabits, * 1024, Gigabits, "Gb"); } -typedef LLUnit F32Bits; -typedef LLUnit F32Kilobits; -typedef LLUnit F32Megabits; -typedef LLUnit F32Gigabits; - -typedef LLUnitImplicit F32BitsImplicit; -typedef LLUnitImplicit F32KilobitsImplicit; -typedef LLUnitImplicit F32MegabitsImplicit; -typedef LLUnitImplicit F32GigabitsImplicit; - -typedef LLUnit F64Bits; -typedef LLUnit F64Kilobits; -typedef LLUnit F64Megabits; -typedef LLUnit F64Gigabits; - -typedef LLUnitImplicit F64BitsImplicit; -typedef LLUnitImplicit F64KilobitsImplicit; -typedef LLUnitImplicit F64MegabitsImplicit; -typedef LLUnitImplicit F64GigabitsImplicit; - -typedef LLUnit S32Bits; -typedef LLUnit S32Kilobits; -typedef LLUnit S32Megabits; -typedef LLUnit S32Gigabits; - -typedef LLUnitImplicit S32BitsImplicit; -typedef LLUnitImplicit S32KilobitsImplicit; -typedef LLUnitImplicit S32MegabitsImplicit; -typedef LLUnitImplicit S32GigabitsImplicit; - -typedef LLUnit S64Bits; -typedef LLUnit S64Kilobits; -typedef LLUnit S64Megabits; -typedef LLUnit S64Gigabits; - -typedef LLUnitImplicit S64BitsImplicit; -typedef LLUnitImplicit S64KilobitsImplicit; -typedef LLUnitImplicit S64MegabitsImplicit; -typedef LLUnitImplicit S64GigabitsImplicit; - -typedef LLUnit U32Bits; -typedef LLUnit U32Kilobits; -typedef LLUnit U32Megabits; -typedef LLUnit U32Gigabits; - -typedef LLUnitImplicit U32BitsImplicit; -typedef LLUnitImplicit U32KilobitsImplicit; -typedef LLUnitImplicit U32MegabitsImplicit; -typedef LLUnitImplicit U32GigabitsImplicit; - -typedef LLUnit U64Bits; -typedef LLUnit U64Kilobits; -typedef LLUnit U64Megabits; -typedef LLUnit U64Gigabits; - -typedef LLUnitImplicit U64BitsImplicit; -typedef LLUnitImplicit U64KilobitsImplicit; -typedef LLUnitImplicit U64MegabitsImplicit; -typedef LLUnitImplicit U64GigabitsImplicit; +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Bits); +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Kilobits); +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Megabits); +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Gigabits); namespace LLUnits { @@ -815,101 +747,13 @@ LL_DECLARE_DERIVED_UNIT(Milliseconds, / 1000, Microseconds, "\x09\x3cs"); LL_DECLARE_DERIVED_UNIT(Microseconds, / 1000, Nanoseconds, "ns"); } -typedef LLUnit F32Seconds; -typedef LLUnit F32Minutes; -typedef LLUnit F32Hours; -typedef LLUnit F32Days; -typedef LLUnit F32Milliseconds; -typedef LLUnit F32Microseconds; -typedef LLUnit F32Nanoseconds; - -typedef LLUnitImplicit F32SecondsImplicit; -typedef LLUnitImplicit F32MinutesImplicit; -typedef LLUnitImplicit F32HoursImplicit; -typedef LLUnitImplicit F32DaysImplicit; -typedef LLUnitImplicit F32MillisecondsImplicit; -typedef LLUnitImplicit F32MicrosecondsImplicit; -typedef LLUnitImplicit F32NanosecondsImplicit; - -typedef LLUnit F64Seconds; -typedef LLUnit F64Minutes; -typedef LLUnit F64Hours; -typedef LLUnit F64Days; -typedef LLUnit F64Milliseconds; -typedef LLUnit F64Microseconds; -typedef LLUnit F64Nanoseconds; - -typedef LLUnitImplicit F64SecondsImplicit; -typedef LLUnitImplicit F64MinutesImplicit; -typedef LLUnitImplicit F64HoursImplicit; -typedef LLUnitImplicit F64DaysImplicit; -typedef LLUnitImplicit F64MillisecondsImplicit; -typedef LLUnitImplicit F64MicrosecondsImplicit; -typedef LLUnitImplicit F64NanosecondsImplicit; - -typedef LLUnit S32Seconds; -typedef LLUnit S32Minutes; -typedef LLUnit S32Hours; -typedef LLUnit S32Days; -typedef LLUnit S32Milliseconds; -typedef LLUnit S32Microseconds; -typedef LLUnit S32Nanoseconds; - -typedef LLUnitImplicit S32SecondsImplicit; -typedef LLUnitImplicit S32MinutesImplicit; -typedef LLUnitImplicit S32HoursImplicit; -typedef LLUnitImplicit S32DaysImplicit; -typedef LLUnitImplicit S32MillisecondsImplicit; -typedef LLUnitImplicit S32MicrosecondsImplicit; -typedef LLUnitImplicit S32NanosecondsImplicit; - -typedef LLUnit S64Seconds; -typedef LLUnit S64Minutes; -typedef LLUnit S64Hours; -typedef LLUnit S64Days; -typedef LLUnit S64Milliseconds; -typedef LLUnit S64Microseconds; -typedef LLUnit S64Nanoseconds; - -typedef LLUnitImplicit S64SecondsImplicit; -typedef LLUnitImplicit S64MinutesImplicit; -typedef LLUnitImplicit S64HoursImplicit; -typedef LLUnitImplicit S64DaysImplicit; -typedef LLUnitImplicit S64MillisecondsImplicit; -typedef LLUnitImplicit S64MicrosecondsImplicit; -typedef LLUnitImplicit S64NanosecondsImplicit; - -typedef LLUnit U32Seconds; -typedef LLUnit U32Minutes; -typedef LLUnit U32Hours; -typedef LLUnit U32Days; -typedef LLUnit U32Milliseconds; -typedef LLUnit U32Microseconds; -typedef LLUnit U32Nanoseconds; - -typedef LLUnitImplicit U32SecondsImplicit; -typedef LLUnitImplicit U32MinutesImplicit; -typedef LLUnitImplicit U32HoursImplicit; -typedef LLUnitImplicit U32DaysImplicit; -typedef LLUnitImplicit U32MillisecondsImplicit; -typedef LLUnitImplicit U32MicrosecondsImplicit; -typedef LLUnitImplicit U32NanosecondsImplicit; - -typedef LLUnit U64Seconds; -typedef LLUnit U64Minutes; -typedef LLUnit U64Hours; -typedef LLUnit U64Days; -typedef LLUnit U64Milliseconds; -typedef LLUnit U64Microseconds; -typedef LLUnit U64Nanoseconds; - -typedef LLUnitImplicit U64SecondsImplicit; -typedef LLUnitImplicit U64MinutesImplicit; -typedef LLUnitImplicit U64HoursImplicit; -typedef LLUnitImplicit U64DaysImplicit; -typedef LLUnitImplicit U64MillisecondsImplicit; -typedef LLUnitImplicit U64MicrosecondsImplicit; -typedef LLUnitImplicit U64NanosecondsImplicit; +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Seconds); +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Minutes); +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Hours); +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Days); +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Milliseconds); +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Microseconds); +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Nanoseconds); namespace LLUnits { @@ -919,65 +763,10 @@ LL_DECLARE_DERIVED_UNIT(Meters, / 100, Centimeters, "cm"); LL_DECLARE_DERIVED_UNIT(Meters, / 1000, Millimeters, "mm"); } -typedef LLUnit F32Meters; -typedef LLUnit F32Kilometers; -typedef LLUnit F32Centimeters; -typedef LLUnit F32Millimeters; - -typedef LLUnitImplicit F32MetersImplicit; -typedef LLUnitImplicit F32KilometersImplicit; -typedef LLUnitImplicit F32CentimetersImplicit; -typedef LLUnitImplicit F32MillimetersImplicit; - -typedef LLUnit F64Meters; -typedef LLUnit F64Kilometers; -typedef LLUnit F64Centimeters; -typedef LLUnit F64Millimeters; - -typedef LLUnitImplicit F64MetersImplicit; -typedef LLUnitImplicit F64KilometersImplicit; -typedef LLUnitImplicit F64CentimetersImplicit; -typedef LLUnitImplicit F64MillimetersImplicit; - -typedef LLUnit S32Meters; -typedef LLUnit S32Kilometers; -typedef LLUnit S32Centimeters; -typedef LLUnit S32Millimeters; - -typedef LLUnitImplicit S32MetersImplicit; -typedef LLUnitImplicit S32KilometersImplicit; -typedef LLUnitImplicit S32CentimetersImplicit; -typedef LLUnitImplicit S32MillimetersImplicit; - -typedef LLUnit S64Meters; -typedef LLUnit S64Kilometers; -typedef LLUnit S64Centimeters; -typedef LLUnit S64Millimeters; - -typedef LLUnitImplicit S64MetersImplicit; -typedef LLUnitImplicit S64KilometersImplicit; -typedef LLUnitImplicit S64CentimetersImplicit; -typedef LLUnitImplicit S64MillimetersImplicit; - -typedef LLUnit U32Meters; -typedef LLUnit U32Kilometers; -typedef LLUnit U32Centimeters; -typedef LLUnit U32Millimeters; - -typedef LLUnitImplicit U32MetersImplicit; -typedef LLUnitImplicit U32KilometersImplicit; -typedef LLUnitImplicit U32CentimetersImplicit; -typedef LLUnitImplicit U32MillimetersImplicit; - -typedef LLUnit U64Meters; -typedef LLUnit U64Kilometers; -typedef LLUnit U64Centimeters; -typedef LLUnit U64Millimeters; - -typedef LLUnitImplicit U64MetersImplicit; -typedef LLUnitImplicit U64KilometersImplicit; -typedef LLUnitImplicit U64CentimetersImplicit; -typedef LLUnitImplicit U64MillimetersImplicit; +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Meters); +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Kilometers); +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Centimeters); +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Millimeters); namespace LLUnits { @@ -999,136 +788,16 @@ LL_DECLARE_DERIVED_UNIT(Triangles, * 1000, Kilotriangles, "ktris"); } // namespace LLUnits // rare units -typedef LLUnit F32Hertz; -typedef LLUnit F32Kilohertz; -typedef LLUnit F32Megahertz; -typedef LLUnit F32Gigahertz; -typedef LLUnit F32Radians; -typedef LLUnit F32Degrees; -typedef LLUnit F32Percent; -typedef LLUnit F32Ratio; -typedef LLUnit F32Triangles; -typedef LLUnit F32KiloTriangles; - -typedef LLUnitImplicit F32HertzImplicit; -typedef LLUnitImplicit F32KilohertzImplicit; -typedef LLUnitImplicit F32MegahertzImplicit; -typedef LLUnitImplicit F32GigahertzImplicit; -typedef LLUnitImplicit F32RadiansImplicit; -typedef LLUnitImplicit F32DegreesImplicit; -typedef LLUnitImplicit F32PercentImplicit; -typedef LLUnitImplicit F32RatioImplicit; -typedef LLUnitImplicit F32TrianglesImplicit; -typedef LLUnitImplicit F32KiloTrianglesImplicit; - -typedef LLUnit F64Hertz; -typedef LLUnit F64Kilohertz; -typedef LLUnit F64Megahertz; -typedef LLUnit F64Gigahertz; -typedef LLUnit F64Radians; -typedef LLUnit F64Degrees; -typedef LLUnit F64Percent; -typedef LLUnit F64Ratio; -typedef LLUnit F64Triangles; -typedef LLUnit F64KiloTriangles; - -typedef LLUnitImplicit F64HertzImplicit; -typedef LLUnitImplicit F64KilohertzImplicit; -typedef LLUnitImplicit F64MegahertzImplicit; -typedef LLUnitImplicit F64GigahertzImplicit; -typedef LLUnitImplicit F64RadiansImplicit; -typedef LLUnitImplicit F64DegreesImplicit; -typedef LLUnitImplicit F64PercentImplicit; -typedef LLUnitImplicit F64RatioImplicit; -typedef LLUnitImplicit F64TrianglesImplicit; -typedef LLUnitImplicit F64KiloTrianglesImplicit; - -typedef LLUnit S32Hertz; -typedef LLUnit S32Kilohertz; -typedef LLUnit S32Megahertz; -typedef LLUnit S32Gigahertz; -typedef LLUnit S32Radians; -typedef LLUnit S32Degrees; -typedef LLUnit S32Percent; -typedef LLUnit S32Ratio; -typedef LLUnit S32Triangles; -typedef LLUnit S32KiloTriangles; - -typedef LLUnitImplicit S32HertzImplicit; -typedef LLUnitImplicit S32KilohertzImplicit; -typedef LLUnitImplicit S32MegahertzImplicit; -typedef LLUnitImplicit S32GigahertzImplicit; -typedef LLUnitImplicit S32RadiansImplicit; -typedef LLUnitImplicit S32DegreesImplicit; -typedef LLUnitImplicit S32PercentImplicit; -typedef LLUnitImplicit S32RatioImplicit; -typedef LLUnitImplicit S32TrianglesImplicit; -typedef LLUnitImplicit S32KiloTrianglesImplicit; - -typedef LLUnit S64Hertz; -typedef LLUnit S64Kilohertz; -typedef LLUnit S64Megahertz; -typedef LLUnit S64Gigahertz; -typedef LLUnit S64Radians; -typedef LLUnit S64Degrees; -typedef LLUnit S64Percent; -typedef LLUnit S64Ratio; -typedef LLUnit S64Triangles; -typedef LLUnit S64KiloTriangles; - -typedef LLUnitImplicit S64HertzImplicit; -typedef LLUnitImplicit S64KilohertzImplicit; -typedef LLUnitImplicit S64MegahertzImplicit; -typedef LLUnitImplicit S64GigahertzImplicit; -typedef LLUnitImplicit S64RadiansImplicit; -typedef LLUnitImplicit S64DegreesImplicit; -typedef LLUnitImplicit S64PercentImplicit; -typedef LLUnitImplicit S64RatioImplicit; -typedef LLUnitImplicit S64TrianglesImplicit; -typedef LLUnitImplicit S64KiloTrianglesImplicit; - -typedef LLUnit U32Hertz; -typedef LLUnit U32Kilohertz; -typedef LLUnit U32Megahertz; -typedef LLUnit U32Gigahertz; -typedef LLUnit U32Radians; -typedef LLUnit U32Degrees; -typedef LLUnit U32Percent; -typedef LLUnit U32Ratio; -typedef LLUnit U32Triangles; -typedef LLUnit U32KiloTriangles; - -typedef LLUnitImplicit U32HertzImplicit; -typedef LLUnitImplicit U32KilohertzImplicit; -typedef LLUnitImplicit U32MegahertzImplicit; -typedef LLUnitImplicit U32GigahertzImplicit; -typedef LLUnitImplicit U32RadiansImplicit; -typedef LLUnitImplicit U32DegreesImplicit; -typedef LLUnitImplicit U32PercentImplicit; -typedef LLUnitImplicit U32RatioImplicit; -typedef LLUnitImplicit U32TrianglesImplicit; -typedef LLUnitImplicit U32KiloTrianglesImplicit; - -typedef LLUnit U64Hertz; -typedef LLUnit U64Kilohertz; -typedef LLUnit U64Megahertz; -typedef LLUnit U64Gigahertz; -typedef LLUnit U64Radians; -typedef LLUnit U64Degrees; -typedef LLUnit U64Percent; -typedef LLUnit U64Ratio; -typedef LLUnit U64Triangles; -typedef LLUnit U64KiloTriangles; - -typedef LLUnitImplicit U64HertzImplicit; -typedef LLUnitImplicit U64KilohertzImplicit; -typedef LLUnitImplicit U64MegahertzImplicit; -typedef LLUnitImplicit U64GigahertzImplicit; -typedef LLUnitImplicit U64RadiansImplicit; -typedef LLUnitImplicit U64DegreesImplicit; -typedef LLUnitImplicit U64PercentImplicit; -typedef LLUnitImplicit U64RatioImplicit; -typedef LLUnitImplicit U64TrianglesImplicit; -typedef LLUnitImplicit U64KiloTrianglesImplicit; +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Hertz); +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Kilohertz); +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Megahertz); +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Gigahertz); +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Radians); +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Degrees); +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Percent); +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Ratio); +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Triangles); +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Kilotriangles); + #endif // LL_LLUNIT_H -- cgit v1.2.3