aboutsummaryrefslogtreecommitdiffstats
path: root/wirish/wirish_math.h
diff options
context:
space:
mode:
Diffstat (limited to 'wirish/wirish_math.h')
-rw-r--r--wirish/wirish_math.h11
1 files changed, 3 insertions, 8 deletions
diff --git a/wirish/wirish_math.h b/wirish/wirish_math.h
index 14614ba..f9062af 100644
--- a/wirish/wirish_math.h
+++ b/wirish/wirish_math.h
@@ -24,7 +24,7 @@
/**
* @file wirish_math.h
- * @brief Includes cmath; provides Arduino-compatible math routines.
+ * @brief Includes <math.h>; provides Arduino-compatible math routines.
*/
#ifndef _WIRING_MATH_H_
@@ -32,8 +32,6 @@
#include <math.h>
-#ifdef __cplusplus
-
/**
* @brief Initialize the pseudo-random number generator.
* @param seed the number used to initialize the seed; cannot be zero.
@@ -78,8 +76,7 @@ long random(long min, long max);
* @param toEnd the end of the value's mapped range.
* @return the mapped value.
*/
-/* TODO: profile code bloat due to inlining this */
-inline long map(long value, long fromStart, long fromEnd,
+static inline long map(long value, long fromStart, long fromEnd,
long toStart, long toEnd) {
return (value - fromStart) * (toEnd - toStart) / (fromEnd - fromStart) +
toStart;
@@ -103,9 +100,7 @@ inline long map(long value, long fromStart, long fromEnd,
#ifdef abs
#undef abs
#endif
-#define abs(x) (((x) > 0) ? (x) : -(unsigned)(x))
-
-#endif
+#define abs(x) (((x) > 0) ? (x) : -(x))
/* Following are duplicate declarations (with Doxygen comments) for
* some of the math.h functions; this is for the convenience of the