mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-21 11:54:15 +01:00
LP-621 the __attribute__ fix does not work for isfinite(), only for isnan() and isinf().
This might be a compiler bug, but luckily it can be worked around.
This commit is contained in:
parent
fd32fc79ba
commit
5b5e61c5b5
@ -26,6 +26,9 @@
|
|||||||
|
|
||||||
#ifndef PIOS_MATH_H
|
#ifndef PIOS_MATH_H
|
||||||
#define PIOS_MATH_H
|
#define PIOS_MATH_H
|
||||||
|
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
// Generic float math constants
|
// Generic float math constants
|
||||||
#define M_E_F 2.71828182845904523536028747135f /* e */
|
#define M_E_F 2.71828182845904523536028747135f /* e */
|
||||||
#define M_LOG2E_F 1.44269504088896340735992468100f /* log_2 (e) */
|
#define M_LOG2E_F 1.44269504088896340735992468100f /* log_2 (e) */
|
||||||
@ -79,12 +82,9 @@
|
|||||||
#define MAX(a, b) ((a) > (b) ? (a) : (b))
|
#define MAX(a, b) ((a) > (b) ? (a) : (b))
|
||||||
#define MIN(a, b) ((a) < (b) ? (a) : (b))
|
#define MIN(a, b) ((a) < (b) ? (a) : (b))
|
||||||
|
|
||||||
#ifndef isfinite
|
|
||||||
#include <math.h>
|
|
||||||
#endif
|
|
||||||
__attribute__((optimize("no-fast-math"))) static inline int IS_REAL(float f)
|
__attribute__((optimize("no-fast-math"))) static inline int IS_REAL(float f)
|
||||||
{
|
{
|
||||||
return isfinite(f);
|
return !(isnan(f) || isinf(f));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bitfield access
|
// Bitfield access
|
||||||
|
Loading…
x
Reference in New Issue
Block a user