summaryrefslogtreecommitdiff
path: root/src
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 /src
parent0587ab0488c46b61d175793f2deedc3a7aa9b600 (diff)
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>
Diffstat (limited to 'src')
-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 @@
25 25
26const double FTW = 0.05; 26const double FTW = 0.05;
27const double FTS = 0.05; 27const double FTS = 0.05;
28const int XMAX = 32767;
28 29
29void init_state(struct State *s) 30void init_state(struct State *s)
30{ 31{
@@ -38,7 +39,7 @@ static int fincmp(const void *a, const void *b)
38 39
39inline int abs15(int x) 40inline int abs15(int x)
40{ 41{
41 return 32767 & (x < 0 ? -x : x); 42 return x < -XMAX ? -XMAX : x > XMAX ? XMAX : x;
42} 43}
43 44
44/* abslute scale is assumed to fit in 15 bits */ 45/* abslute scale is assumed to fit in 15 bits */