summaryrefslogtreecommitdiff
path: root/include/math_util.h
diff options
context:
space:
mode:
authorGwendal Grignou <gwendal@chromium.org>2014-10-28 17:52:52 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-11-09 01:07:07 +0000
commit96a39e7ee73f7781f57b330bfd0be96d822366e6 (patch)
tree33eba330254609ce411703e89e883b64eef4ddd2 /include/math_util.h
parentbbe9a877ecc4f81fc17011b29a0d3bd13eac4540 (diff)
downloadchrome-ec-96a39e7ee73f7781f57b330bfd0be96d822366e6.tar.gz
math: use CONFIG_FPU when using float.
ifdef code than needs CONFIG_FPU (acos and friends) BRANCH=ToT BUG=chrome-os-partner:32050 TEST=define CONFIG_FPU on host board and use it. Change-Id: I1c4ed16c23450bb4059d26044f4c1fe45b33674e Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/226414 Reviewed-by: Alec Berg <alecaberg@chromium.org> Reviewed-by: Sheng-liang Song <ssl@chromium.org>
Diffstat (limited to 'include/math_util.h')
-rw-r--r--include/math_util.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/math_util.h b/include/math_util.h
index 044c411b23..6ae36a995b 100644
--- a/include/math_util.h
+++ b/include/math_util.h
@@ -8,7 +8,12 @@
#ifndef __CROS_MATH_UTIL_H
#define __CROS_MATH_UTIL_H
+#ifdef CONFIG_FPU
typedef float matrix_3x3_t[3][3];
+#else
+typedef int matrix_3x3_t[3][3];
+#endif
+
typedef int vector_3_t[3];
@@ -16,6 +21,7 @@ typedef int vector_3_t[3];
#define SQ(x) ((x) * (x))
#define ABS(x) ((x) >= 0 ? (x) : -(x))
+#ifdef CONFIG_FPU
/**
* Find acos(x) in degrees. Argument is clipped to [-1.0, 1.0].
@@ -36,6 +42,8 @@ float arc_cos(float x);
*/
float cosine_of_angle_diff(const vector_3_t v1, const vector_3_t v2);
+#endif
+
/**
* Rotate vector v by rotation matrix R.
*