aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenrik Rydberg <rydberg@euromail.se>2010-03-21 15:27:36 +0100
committerHenrik Rydberg <rydberg@euromail.se>2010-03-21 15:27:36 +0100
commited3c4188ec7af3337b27a968be3f523bc687cded (patch)
treefbdea3ec321cc1ffd41b35ec149772c0595d6938
parent0587ab0488c46b61d175793f2deedc3a7aa9b600 (diff)
downloadxorg-input-kobomultitouch-ed3c4188ec7af3337b27a968be3f523bc687cded.tar.gz
xorg-input-kobomultitouch-ed3c4188ec7af3337b27a968be3f523bc687cded.tar.bz2
xorg-input-kobomultitouch-ed3c4188ec7af3337b27a968be3f523bc687cded.zip
Correct double commit mistake
The recent patch sequence got slightly contaminated with versions of abs15() by mistake. On top of it all, the one committed did the wrong thing. This patch corrects abs15() to do simple clamping of values outside the allowed range. Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
-rw-r--r--src/state.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/state.c b/src/state.c
index 182a508..b9b7bbc 100644
--- a/src/state.c
+++ b/src/state.c
@@ -25,6 +25,7 @@
const double FTW = 0.05;
const double FTS = 0.05;
+const int XMAX = 32767;
void init_state(struct State *s)
{
@@ -38,7 +39,7 @@ static int fincmp(const void *a, const void *b)
inline int abs15(int x)
{
- return 32767 & (x < 0 ? -x : x);
+ return x < -XMAX ? -XMAX : x > XMAX ? XMAX : x;
}
/* abslute scale is assumed to fit in 15 bits */