diff options
Diffstat (limited to 'src/state.c')
| -rw-r--r-- | src/state.c | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/src/state.c b/src/state.c index 774828a..31eca70 100644 --- a/src/state.c +++ b/src/state.c | |||
| @@ -36,16 +36,9 @@ static int fincmp(const void *a, const void *b) | |||
| 36 | return ((struct FingerState *)a)->id - ((struct FingerState *)b)->id; | 36 | return ((struct FingerState *)a)->id - ((struct FingerState *)b)->id; |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | /* seander@cs.stanford.edu */ | ||
| 40 | inline unsigned abs32(int x) | ||
| 41 | { | ||
| 42 | int const m = x >> 31; | ||
| 43 | return (x + m) ^ m; | ||
| 44 | } | ||
| 45 | |||
| 46 | inline int abs15(int x) | 39 | inline int abs15(int x) |
| 47 | { | 40 | { |
| 48 | return 32767 & abs32(x); | 41 | return 32767 & (x < 0 ? -x : x); |
| 49 | } | 42 | } |
| 50 | 43 | ||
| 51 | /* abslute scale is assumed to fit in 15 bits */ | 44 | /* abslute scale is assumed to fit in 15 bits */ |
