summaryrefslogtreecommitdiff
path: root/indra/llcommon/llunit.h
diff options
context:
space:
mode:
authorRichard Linden <none@none>2012-12-06 17:24:41 -0800
committerRichard Linden <none@none>2012-12-06 17:24:41 -0800
commit3745d1254acc386acaadd20016123c9a47b8d10c (patch)
tree65cb88589a2f2b53b0f2b4a29056d5188cd432e6 /indra/llcommon/llunit.h
parent2facd6374517d88f03e3f06b1ccc02565da26b45 (diff)
SH-3406 WIP convert fast timers to lltrace system
added unit tests for LLUnit
Diffstat (limited to 'indra/llcommon/llunit.h')
-rw-r--r--indra/llcommon/llunit.h40
1 files changed, 20 insertions, 20 deletions
diff --git a/indra/llcommon/llunit.h b/indra/llcommon/llunit.h
index e57974c429..1f3ed0237c 100644
--- a/indra/llcommon/llunit.h
+++ b/indra/llcommon/llunit.h
@@ -334,7 +334,7 @@ struct HighestPrecisionType<LLUnit<UNIT_TYPE, STORAGE_TYPE> >
typedef typename HighestPrecisionType<STORAGE_TYPE>::type_t type_t;
};
-#define LL_DECLARE_DERIVED_UNIT(base_unit_name, unit_name, conversion_factor) \
+#define LL_DECLARE_DERIVED_UNIT(conversion_factor, base_unit_name, unit_name) \
struct unit_name \
{ \
typedef base_unit_name base_unit_t; \
@@ -358,30 +358,30 @@ struct ConversionFactor<base_unit_name, unit_name, STORAGE_TYPE> \
}
struct Bytes { typedef Bytes base_unit_t; };
-LL_DECLARE_DERIVED_UNIT(Bytes, Kilobytes, 1024);
-LL_DECLARE_DERIVED_UNIT(Bytes, Megabytes, 1024 * 1024);
-LL_DECLARE_DERIVED_UNIT(Bytes, Gigabytes, 1024 * 1024 * 1024);
-LL_DECLARE_DERIVED_UNIT(Bytes, Bits, (1.0 / 8.0));
-LL_DECLARE_DERIVED_UNIT(Bytes, Kilobits, (1024 / 8));
-LL_DECLARE_DERIVED_UNIT(Bytes, Megabits, (1024 / 8));
-LL_DECLARE_DERIVED_UNIT(Bytes, Gigabits, (1024 * 1024 * 1024 / 8));
+LL_DECLARE_DERIVED_UNIT(1024, Bytes, Kilobytes);
+LL_DECLARE_DERIVED_UNIT(1024 * 1024, Bytes, Megabytes);
+LL_DECLARE_DERIVED_UNIT(1024 * 1024 * 1024, Bytes, Gigabytes);
+LL_DECLARE_DERIVED_UNIT((1.0 / 8.0), Bytes, Bits);
+LL_DECLARE_DERIVED_UNIT((1024 / 8), Bytes, Kilobits);
+LL_DECLARE_DERIVED_UNIT((1024 / 8), Bytes, Megabits);
+LL_DECLARE_DERIVED_UNIT((1024 * 1024 * 1024 / 8), Bytes, Gigabits);
struct Seconds { typedef Seconds base_unit_t; };
-LL_DECLARE_DERIVED_UNIT(Seconds, Minutes, 60);
-LL_DECLARE_DERIVED_UNIT(Seconds, Hours, 60 * 60);
-LL_DECLARE_DERIVED_UNIT(Seconds, Milliseconds, (1.0 / 1000.0));
-LL_DECLARE_DERIVED_UNIT(Seconds, Microseconds, (1.0 / (1000000.0)));
-LL_DECLARE_DERIVED_UNIT(Seconds, Nanoseconds, (1.0 / (1000000000.0)));
+LL_DECLARE_DERIVED_UNIT(60, Seconds, Minutes);
+LL_DECLARE_DERIVED_UNIT(60 * 60, Seconds, Hours);
+LL_DECLARE_DERIVED_UNIT((1.0 / 1000.0), Seconds, Milliseconds);
+LL_DECLARE_DERIVED_UNIT((1.0 / (1000000.0)), Seconds, Microseconds);
+LL_DECLARE_DERIVED_UNIT((1.0 / (1000000000.0)), Seconds, Nanoseconds);
struct Meters { typedef Meters base_unit_t; };
-LL_DECLARE_DERIVED_UNIT(Meters, Kilometers, 1000);
-LL_DECLARE_DERIVED_UNIT(Meters, Centimeters, (1.0 / 100.0));
-LL_DECLARE_DERIVED_UNIT(Meters, Millimeters, (1.0 / 1000.0));
+LL_DECLARE_DERIVED_UNIT(1000, Meters, Kilometers);
+LL_DECLARE_DERIVED_UNIT((1.0 / 100.0), Meters, Centimeters);
+LL_DECLARE_DERIVED_UNIT((1.0 / 1000.0), Meters, Millimeters);
struct Hertz { typedef Hertz base_unit_t; };
-LL_DECLARE_DERIVED_UNIT(Hertz, Kilohertz, 1000);
-LL_DECLARE_DERIVED_UNIT(Hertz, Megahertz, 1000 * 1000);
-LL_DECLARE_DERIVED_UNIT(Hertz, Gigahertz, 1000 * 1000 * 1000);
-}
+LL_DECLARE_DERIVED_UNIT(1000, Hertz, Kilohertz);
+LL_DECLARE_DERIVED_UNIT(1000 * 1000, Hertz, Megahertz);
+LL_DECLARE_DERIVED_UNIT(1000 * 1000 * 1000, Hertz, Gigahertz);
+} // namespace LLUnits
#endif // LL_LLUNIT_H