Commit 42b13eff authored by Alexandre Julliard's avatar Alexandre Julliard

include: Add some C99 floating point comparison macros.

parent 8772b384
...@@ -342,6 +342,34 @@ static inline int __signbit(double x) ...@@ -342,6 +342,34 @@ static inline int __signbit(double x)
#endif #endif
#ifdef _UCRT
_ACRTIMP int __cdecl _dpcomp(double, double);
_ACRTIMP int __cdecl _fdpcomp(float, float);
#define _FP_LT 1
#define _FP_EQ 2
#define _FP_GT 4
#ifdef __GNUC__
# define isgreater(x, y) __builtin_isgreater(x, y)
# define isgreaterequal(x, y) __builtin_isgreaterequal(x, y)
# define isless(x, y) __builtin_isless(x, y)
# define islessequal(x, y) __builtin_islessequal(x, y)
# define islessgreater(x, y) __builtin_islessgreater(x, y)
# define isunordered(x, y) __builtin_isunordered(x, y)
#else
# define __FP_COMPARE(x,y) (sizeof(x) == sizeof(float) && sizeof(y) == sizeof(float) ? _fdpcomp(x,y) : _dpcomp(x,y))
# define isgreater(x, y) ((__FP_COMPARE(x, y) & _FP_GT) != 0)
# define isgreaterequal(x, y) ((__FP_COMPARE(x, y) & (_FP_GT|_FP_EQ)) != 0)
# define isless(x, y) ((__FP_COMPARE(x, y) & _FP_LT) != 0)
# define islessequal(x, y) ((__FP_COMPARE(x, y) & (_FP_LT|_FP_EQ)) != 0)
# define islessgreater(x, y) ((__FP_COMPARE(x, y) & (_FP_LT|_FP_GT)) != 0)
# define isunordered(x, y) (!__FP_COMPARE(x, y))
#endif
#endif /* _UCRT */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment