summaryrefslogtreecommitdiff
path: root/n/avr/modules/math/fixed/fixed.h
diff options
context:
space:
mode:
authorschodet2005-10-09 12:42:47 +0000
committerschodet2005-10-09 12:42:47 +0000
commitc010d773fc239bd74f177acde5341baa5cbd784f (patch)
tree6c556f0fa6140cd3df05debf629e44f090aa3784 /n/avr/modules/math/fixed/fixed.h
parente061346e31c0281f97393762a7e55f486a26be4a (diff)
Ajout de l'arondie sur la multiplication.
Diffstat (limited to 'n/avr/modules/math/fixed/fixed.h')
-rw-r--r--n/avr/modules/math/fixed/fixed.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/n/avr/modules/math/fixed/fixed.h b/n/avr/modules/math/fixed/fixed.h
index 9c031dc..2337b1c 100644
--- a/n/avr/modules/math/fixed/fixed.h
+++ b/n/avr/modules/math/fixed/fixed.h
@@ -54,7 +54,8 @@ 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) (((uint64_t) (a) * (uint64_t) (b)) >> 24)
+#define fixed_mul_f824(a, b) (((uint64_t) (a) * (uint64_t) (b) \
+ + 0x800000LL) >> 24)
/** Divide f8.24 by f8.24, return f8.24. */
#define fixed_div_f824(a, b) (((uint64_t) (a) << 24) / (uint64_t) (b))