Workaround compiling with -ffast-math

And add a compiler warning.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui
2018-11-02 13:57:19 +00:00
parent 45e9530bcb
commit be09a9a835
3 changed files with 13 additions and 2 deletions

View File

@ -4,6 +4,17 @@
#include <ctype.h>
#include <stddef.h>
#include <stdlib.h>
#include <math.h>
#ifdef __FAST_MATH__
#warning Use of -ffast-math can cause rendering error or artifacts, \
therefore it is not recommended.
#endif
__attribute__((optimize("-fno-fast-math")))
static inline bool safe_isnan(double a) {
return isnan(a);
}
/**
* Normalize an int value to a specific range.