From e4cb79a343ea29b96e069d673ddc2475ff4b4e48 Mon Sep 17 00:00:00 2001 From: Andrey Mazo Date: Tue, 24 Nov 2009 10:45:08 +0100 Subject: [PATCH] bug 701: optimize Max (hp, hp) --- src/simulator/high-precision.cc | 22 ---------------------- src/simulator/high-precision.h | 28 ++++++++++++++++++++++++++-- 2 files changed, 26 insertions(+), 24 deletions(-) diff --git a/src/simulator/high-precision.cc b/src/simulator/high-precision.cc index 6f98a1949..685822567 100644 --- a/src/simulator/high-precision.cc +++ b/src/simulator/high-precision.cc @@ -38,27 +38,5 @@ HighPrecision Abs (HighPrecision const &value) return value; } } -HighPrecision Max (HighPrecision const &a, HighPrecision const &b) -{ - if (a.Compare (b) >= 0) - { - return a; - } - else - { - return b; - } -} -HighPrecision Min (HighPrecision const &a, HighPrecision const &b) -{ - if (a.Compare (b) <= 0) - { - return a; - } - else - { - return b; - } -} }; /* namespace ns3 */ diff --git a/src/simulator/high-precision.h b/src/simulator/high-precision.h index 61e414dd5..0b62b912e 100644 --- a/src/simulator/high-precision.h +++ b/src/simulator/high-precision.h @@ -32,8 +32,32 @@ namespace ns3 { HighPrecision Abs (HighPrecision const &value); -HighPrecision Max (HighPrecision const &a, HighPrecision const &b); -HighPrecision Min (HighPrecision const &a, HighPrecision const &b); +inline HighPrecision Max (HighPrecision const &a, HighPrecision const &b); +inline HighPrecision Min (HighPrecision const &a, HighPrecision const &b); + + +inline HighPrecision Max (HighPrecision const &a, HighPrecision const &b) +{ + if (a.Compare (b) >= 0) + { + return a; + } + else + { + return b; + } +} +inline HighPrecision Min (HighPrecision const &a, HighPrecision const &b) +{ + if (a.Compare (b) <= 0) + { + return a; + } + else + { + return b; + } +} }; /* namespace ns3 */