From ed3c4188ec7af3337b27a968be3f523bc687cded Mon Sep 17 00:00:00 2001 From: Henrik Rydberg Date: Sun, 21 Mar 2010 15:27:36 +0100 Subject: 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 --- src/state.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 */ -- cgit v1.2.3