diff options
author | Harald Welte <laforge@gnumonks.org> | 2010-02-23 01:29:18 +0100 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2010-02-23 01:44:28 +0100 |
commit | c7224b79bd8631b16aea3825d11b6cd0624b8d17 (patch) | |
tree | 15af8575f29f08f22e9caa7c2defde065cc8bb34 /src/target/firmware/calypso/tpu.c | |
parent | 6f14e4e969e4a860a1635e4cdc7c4343c875313c (diff) |
Calyspo TPU: make add_mod5000() accept signed values
Sometimes we want to 'add' a negative value but still want the
result to be correct!
Diffstat (limited to 'src/target/firmware/calypso/tpu.c')
-rw-r--r-- | src/target/firmware/calypso/tpu.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/target/firmware/calypso/tpu.c b/src/target/firmware/calypso/tpu.c index f0172e2e..0df70a2c 100644 --- a/src/target/firmware/calypso/tpu.c +++ b/src/target/firmware/calypso/tpu.c @@ -274,9 +274,9 @@ uint16_t tpu_get_synchro(void) } /* add two numbers, modulo 5000, and ensure the result is positive */ -uint16_t add_mod5000(uint16_t a, uint16_t b) +uint16_t add_mod5000(int16_t a, int16_t b) { - int32_t sum = (uint32_t)a + (uint32_t)b; + int32_t sum = (int32_t)a + (int32_t)b; sum %= 5000; |