diff options
author | Patryk Duda <pdk@semihalf.com> | 2022-01-28 12:19:57 +0100 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2022-02-01 22:35:46 +0000 |
commit | 17e3a7568331291accdb8364846fa8d7619b6bec (patch) | |
tree | f86ba581f03543db4eb807f439686460aeeb8a53 /builtin | |
parent | a1d1af858da7621fb1cd840afc33d935d07af5f2 (diff) | |
download | chrome-ec-17e3a7568331291accdb8364846fa8d7619b6bec.tar.gz |
math: Introduce isnan and isinf functions
This patch adds functions responsible for checking if floating point
operation result is NaN or infinity.
Minute-ia specific functions were removed, because generic version
should be used.
To test added functions, 'fp' unit test was extended.
BUG=b:215606535
BRANCH=none
TEST=make buildall
TEST=make runhosttests
Signed-off-by: Patryk Duda <pdk@semihalf.com>
Change-Id: I68f46e91491b4a221beccde4275fd27a5424a048
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3423529
Reviewed-by: Bobby Casey <bobbycasey@google.com>
Reviewed-by: Tom Hughes <tomhughes@chromium.org>
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/math.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/builtin/math.h b/builtin/math.h index 30a8849bd6..9292ac8b34 100644 --- a/builtin/math.h +++ b/builtin/math.h @@ -6,6 +6,17 @@ #ifndef __CROS_EC_MATH_H__ #define __CROS_EC_MATH_H__ +#include <stdbool.h> #include "fpu.h" +static inline bool isnan(float a) +{ + return __builtin_isnan(a); +} + +static inline bool isinf(float a) +{ + return __builtin_isinf(a); +} + #endif /* __CROS_EC_MATH_H__ */ |