
Untitled
By: a guest on
May 9th, 2012 | syntax:
Diff | size: 1.06 KB | hits: 23 | expires: Never
diff --git a/xbmc/utils/MathUtils.h b/xbmc/utils/MathUtils.h
index d914e43..8feb396 100644
--- a/xbmc/utils/MathUtils.h
+++ b/xbmc/utils/MathUtils.h
@@ -24,6 +24,9 @@
#include <cassert>
#include <climits>
#include <cmath>
+#include "log.h"
+
+#define round_int(x) round_int_func(x, __FILE__, __LINE__)
/*! \brief Math utility class.
Note that the test() routine should return true for all implementations
@@ -46,10 +49,14 @@ namespace MathUtils
Make sure MathUtils::test() returns true for each implementation.
\sa truncate_int, test
*/
- inline int round_int (double x)
+ inline int round_int_func (double x, const char* file, int line)
{
- assert(x > static_cast<double>(INT_MIN / 2) - 1.0);
- assert(x < static_cast <double>(INT_MAX / 2) + 1.0);
+ if (x > static_cast<double>(INT_MIN / 2) - 1.0 || x < static_cast <double>(INT_MAX / 2) + 1.0)
+ {
+ CLog::Log(LOGDEBUG, "%s:%i value %f out of range", file, line, (double)x);
+ abort();
+ }
+
const float round_to_nearest = 0.5f;
int i;