Add assertion to detect TimeUnit<N> divide by zero (if not detected, it creates an infinite loop)
authorGustavo J. A. M. Carneiro <gjc@inescporto.pt>
Thu Apr 17 17:19:24 2008 +0100 (22 months ago)
changeset 29218a616a8b723a
parent 2920 67a8290b9336
child 2923 dbbe74916235
child 2972 d76553495b91
child 2987 4fe951be604c
Add assertion to detect TimeUnit<N> divide by zero (if not detected, it creates an infinite loop)
src/simulator/nstime.h
     1.1 --- a/src/simulator/nstime.h	Wed Apr 16 10:52:38 2008 -0700
     1.2 +++ b/src/simulator/nstime.h	Thu Apr 17 17:19:24 2008 +0100
     1.3 @@ -274,6 +274,7 @@
     1.4  template <int N1, int N2>
     1.5  TimeUnit<N1-N2> operator / (TimeUnit<N1> const &lhs, TimeUnit<N2> const &rhs)
     1.6  {
     1.7 +  NS_ASSERT (rhs.GetHighPrecision ().GetDouble () != 0);
     1.8    HighPrecision retval = lhs.GetHighPrecision ();
     1.9    retval.Div (rhs.GetHighPrecision ());
    1.10    return TimeUnit<N1-N2> (retval);