Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 9th, 2012  |  syntax: Diff  |  size: 1.06 KB  |  hits: 23  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. diff --git a/xbmc/utils/MathUtils.h b/xbmc/utils/MathUtils.h
  2. index d914e43..8feb396 100644
  3. --- a/xbmc/utils/MathUtils.h
  4. +++ b/xbmc/utils/MathUtils.h
  5. @@ -24,6 +24,9 @@
  6.  #include <cassert>
  7.  #include <climits>
  8.  #include <cmath>
  9. +#include "log.h"
  10. +
  11. +#define round_int(x) round_int_func(x, __FILE__, __LINE__)
  12.  
  13.  /*! \brief Math utility class.
  14.   Note that the test() routine should return true for all implementations
  15. @@ -46,10 +49,14 @@ namespace MathUtils
  16.     Make sure MathUtils::test() returns true for each implementation.
  17.     \sa truncate_int, test
  18.     */
  19. -  inline int round_int (double x)
  20. +  inline int round_int_func (double x, const char* file, int line)
  21.    {
  22. -    assert(x > static_cast<double>(INT_MIN / 2) - 1.0);
  23. -    assert(x < static_cast <double>(INT_MAX / 2) + 1.0);
  24. +    if (x > static_cast<double>(INT_MIN / 2) - 1.0 || x < static_cast <double>(INT_MAX / 2) + 1.0)
  25. +    {
  26. +      CLog::Log(LOGDEBUG, "%s:%i value %f out of range", file, line, (double)x);
  27. +      abort();
  28. +    }
  29. +
  30.      const float round_to_nearest = 0.5f;
  31.      int i;