summaryrefslogtreecommitdiff
path: root/n/avr/modules/math/fixed/fixed.h
diff options
context:
space:
mode:
authorschodet2005-08-17 20:37:34 +0000
committerschodet2005-08-17 20:37:34 +0000
commit875991a3399c5326036cfe2d3023b567ce4666a9 (patch)
tree3bb272c4427298042f1129a75e6bfdab6d4fe75c /n/avr/modules/math/fixed/fixed.h
parent99d9fd4751024915868c9eeff0b5d9497b3b468c (diff)
Ajout du test mul et div.
Ajout du code host. Ajout des timings.
Diffstat (limited to 'n/avr/modules/math/fixed/fixed.h')
-rw-r--r--n/avr/modules/math/fixed/fixed.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/n/avr/modules/math/fixed/fixed.h b/n/avr/modules/math/fixed/fixed.h
index ab20779..95b1766 100644
--- a/n/avr/modules/math/fixed/fixed.h
+++ b/n/avr/modules/math/fixed/fixed.h
@@ -25,6 +25,8 @@
*
* }}} */
+#ifndef HOST
+
/** Multiply f8.24 by f8.24, return f8.24. */
#define fixed_mul_f824(a, b) ({ \
uint16_t dummy; \
@@ -33,4 +35,18 @@
int32_t
fixed_mul_f824_asm (uint16_t dummy, int32_t a, int32_t b);
+/** Divide f8.24 by f8.24, return f8.24. */
+int32_t
+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)
+
+/** Divide f8.24 by f8.24, return f8.24. */
+#define fixed_div_f824(a, b) (((uint64_t) (a) << 24) / (uint64_t) (b))
+
+#endif
+
#endif /* fixed_h */