From 9866bb7e6086d33363efafef04b1eaf4827b1b95 Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Sat, 26 Apr 2008 08:08:37 +0200 Subject: * digital/avr/modules/math/fixed: - fixed a bug on host with unsigned numbers as input to macros. --- digital/avr/modules/math/fixed/fixed.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'digital/avr/modules/math') diff --git a/digital/avr/modules/math/fixed/fixed.h b/digital/avr/modules/math/fixed/fixed.h index a3200c18..7bc45d6a 100644 --- a/digital/avr/modules/math/fixed/fixed.h +++ b/digital/avr/modules/math/fixed/fixed.h @@ -54,11 +54,13 @@ fixed_div_f824 (int32_t a, int32_t b); #else /* HOST */ /** Multiply f8.24 by f8.24, return f8.24. */ -#define fixed_mul_f824(a, b) (((int64_t) (a) * (int64_t) (b) \ - + 0x800000LL) >> 24) +#define fixed_mul_f824(a, b) \ + (((int64_t) (int32_t) (a) * (int64_t) (int32_t) (b) \ + + 0x800000LL) >> 24) /** Divide f8.24 by f8.24, return f8.24. */ -#define fixed_div_f824(a, b) (((int64_t) (a) << 24) / (int64_t) (b)) +#define fixed_div_f824(a, b) \ + (((int64_t) (int32_t) (a) << 24) / (int64_t) (int32_t) (b)) #endif -- cgit v1.2.3