[xboxdrv] 70/78: Don't assert() in to_float(), just clamp the return value
Andrey Rahmatullin
wrar-guest at moszumanska.debian.org
Sun Feb 21 17:55:13 UTC 2016
This is an automated email from the git hooks/post-receive script.
wrar-guest pushed a commit to branch master
in repository xboxdrv.
commit 605e45ede093e58f38ced600f18fb69d187d3ee2
Author: Ingo Ruhnke <grumbel at gmail.com>
Date: Mon Nov 9 11:14:02 2015 +0100
Don't assert() in to_float(), just clamp the return value
Fixes #120 might still be worth to investigate why the values go out of range in the first place
---
src/helper.cpp | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/src/helper.cpp b/src/helper.cpp
index 37d6994..04e9d1e 100644
--- a/src/helper.cpp
+++ b/src/helper.cpp
@@ -155,10 +155,9 @@ float to_float_no_range_check(int value, int min, int max)
float to_float(int value, int min, int max)
{
- assert(value >= min);
- assert(value <= max);
-
- return to_float_no_range_check(value, min, max);
+ return Math::clamp(-1.0f,
+ to_float_no_range_check(value, min, max),
+ 1.0f);
}
int from_float(float value, int min, int max)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/xboxdrv.git
More information about the Pkg-games-commits
mailing list