summaryrefslogtreecommitdiff
path: root/digital/avr
diff options
context:
space:
mode:
authorNicolas Schodet2008-04-26 08:08:37 +0200
committerNicolas Schodet2008-04-26 08:08:37 +0200
commit9866bb7e6086d33363efafef04b1eaf4827b1b95 (patch)
treeb4f9e3b3df8faa612086495024f3e93909d3d7aa /digital/avr
parent96bc37262ff5d16cf3f4edaa9c5d8b38e0aaf590 (diff)
* digital/avr/modules/math/fixed:
- fixed a bug on host with unsigned numbers as input to macros.
Diffstat (limited to 'digital/avr')
-rw-r--r--digital/avr/modules/math/fixed/fixed.h8
1 files changed, 5 insertions, 3 deletions
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