diff --git a/src/simulator/high-precision.cc b/src/simulator/high-precision.cc index 3a62391d7..f2a5cba81 100644 --- a/src/simulator/high-precision.cc +++ b/src/simulator/high-precision.cc @@ -159,4 +159,38 @@ HighPrecision::Zero (void) #endif /* HIGH_PRECISION_I128 */ +HighPrecision Abs (HighPrecision const &value) +{ + if (value.Compare (HighPrecision::Zero ()) <= 0) + { + return HighPrecision::Zero ().Sub (value); + } + else + { + 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 2a4b5788a..54d9a2938 100644 --- a/src/simulator/high-precision.h +++ b/src/simulator/high-precision.h @@ -54,7 +54,6 @@ private: int64_t m_low; }; - #else /* HIGH_PRECISION_I128 */ /** @@ -88,6 +87,10 @@ private: #endif /* HIGH_PRECISION_I128 */ +HighPrecision Abs (HighPrecision const &value); +HighPrecision Max (HighPrecision const &a, HighPrecision const &b); +HighPrecision Min (HighPrecision const &a, HighPrecision const &b); + }; /* namespace ns3 */ #endif /* HIGH_PRECISION_H */