summaryrefslogtreecommitdiffstats
path: root/src/util/math.h
diff options
context:
space:
mode:
authorOwen Williams <owilliams@mixxx.org>2014-07-01 08:16:29 -0400
committerOwen Williams <owilliams@mixxx.org>2014-07-01 08:16:29 -0400
commit1e4e407d870a5be86f7e47c9039569beb4b4d3cd (patch)
treecb6fbb93efa80403f93fcb0268e5cec5a290d0e8 /src/util/math.h
parentb525c47057f12bec3627d1cbc43af7c022fdfde0 (diff)
Debug assert if math_clamp is used incorrectly
Diffstat (limited to 'src/util/math.h')
-rw-r--r--src/util/math.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/util/math.h b/src/util/math.h
index 7a580fdf43..b425e2cd9b 100644
--- a/src/util/math.h
+++ b/src/util/math.h
@@ -17,7 +17,9 @@ using std::fabs;
template <typename T>
inline T math_clamp(const T& value, const T& min, const T& max) {
- // XXX: If max < min, behavior is undefined.
+ // XXX: If max < min, behavior is undefined, and has been causing problems.
+ // if debugging is on, assert when this happens.
+ Q_ASSERT(max >= min);
if (value > max) {
return max;
}