diff options
Diffstat (limited to 'src/state.c')
| -rw-r--r-- | src/state.c | 3 |
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 | ||
| 26 | const double FTW = 0.05; | 26 | const double FTW = 0.05; |
| 27 | const double FTS = 0.05; | 27 | const double FTS = 0.05; |
| 28 | const int XMAX = 32767; | ||
| 28 | 29 | ||
| 29 | void init_state(struct State *s) | 30 | void init_state(struct State *s) |
| 30 | { | 31 | { |
| @@ -38,7 +39,7 @@ static int fincmp(const void *a, const void *b) | |||
| 38 | 39 | ||
| 39 | inline int abs15(int x) | 40 | inline 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 */ |
