mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-20 11:11:24 +00:00
Cleanups to math.h that prevent namespace conflicts with C++.
Reviewed by: bde MFC after: 3 days
This commit is contained in:
parent
bf0354c0f2
commit
a3fc79de87
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=253215
@ -80,27 +80,33 @@ extern const union __nan_un {
|
|||||||
#define FP_NORMAL 0x04
|
#define FP_NORMAL 0x04
|
||||||
#define FP_SUBNORMAL 0x08
|
#define FP_SUBNORMAL 0x08
|
||||||
#define FP_ZERO 0x10
|
#define FP_ZERO 0x10
|
||||||
#define fpclassify(x) \
|
|
||||||
((sizeof (x) == sizeof (float)) ? __fpclassifyf(x) \
|
|
||||||
: (sizeof (x) == sizeof (double)) ? __fpclassifyd(x) \
|
|
||||||
: __fpclassifyl(x))
|
|
||||||
|
|
||||||
#define isfinite(x) \
|
#if __STDC_VERSION__ >= 201112L
|
||||||
((sizeof (x) == sizeof (float)) ? __isfinitef(x) \
|
#define __fp_type_select(x, f, d, ld) _Generic((x), \
|
||||||
: (sizeof (x) == sizeof (double)) ? __isfinite(x) \
|
float: f(x), \
|
||||||
: __isfinitel(x))
|
double: d(x), \
|
||||||
#define isinf(x) \
|
long double: ld(x))
|
||||||
((sizeof (x) == sizeof (float)) ? __isinff(x) \
|
#elif __GNUC_PREREQ__(5, 1)
|
||||||
: (sizeof (x) == sizeof (double)) ? isinf(x) \
|
#define __fp_type_select(x, f, d, ld) __builtin_choose_expr( \
|
||||||
: __isinfl(x))
|
__builtin_types_compatible_p(__typeof(x), long double), ld(x), \
|
||||||
|
__builtin_choose_expr( \
|
||||||
|
__builtin_types_compatible_p(__typeof(x), double), d(x), \
|
||||||
|
__builtin_choose_expr( \
|
||||||
|
__builtin_types_compatible_p(__typeof(x), float), f(x), (void)0)))
|
||||||
|
#else
|
||||||
|
#define __fp_type_select(x, f, d, ld) \
|
||||||
|
((sizeof(x) == sizeof(float)) ? f(x) \
|
||||||
|
: (sizeof(x) == sizeof(double)) ? d(x) \
|
||||||
|
: ld(x))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define fpclassify(x) \
|
||||||
|
__fp_type_select(x, __fpclassifyf, __fpclassifyd, __fpclassifyd)
|
||||||
|
#define isfinite(x) __fp_type_select(x, __isfinitef, __isfinite, __isfinitel)
|
||||||
|
#define isinf(x) __fp_type_select(x, __isinff, __isinf, __isinfl)
|
||||||
#define isnan(x) \
|
#define isnan(x) \
|
||||||
((sizeof (x) == sizeof (float)) ? __isnanf(x) \
|
__fp_type_select(x, __inline_isnanf, __inline_isnan, __inline_isnanl)
|
||||||
: (sizeof (x) == sizeof (double)) ? isnan(x) \
|
#define isnormal(x) __fp_type_select(x, __isnormalf, __isnormal, __isnormall)
|
||||||
: __isnanl(x))
|
|
||||||
#define isnormal(x) \
|
|
||||||
((sizeof (x) == sizeof (float)) ? __isnormalf(x) \
|
|
||||||
: (sizeof (x) == sizeof (double)) ? __isnormal(x) \
|
|
||||||
: __isnormall(x))
|
|
||||||
|
|
||||||
#ifdef __MATH_BUILTIN_RELOPS
|
#ifdef __MATH_BUILTIN_RELOPS
|
||||||
#define isgreater(x, y) __builtin_isgreater((x), (y))
|
#define isgreater(x, y) __builtin_isgreater((x), (y))
|
||||||
@ -119,10 +125,7 @@ extern const union __nan_un {
|
|||||||
#define isunordered(x, y) (isnan(x) || isnan(y))
|
#define isunordered(x, y) (isnan(x) || isnan(y))
|
||||||
#endif /* __MATH_BUILTIN_RELOPS */
|
#endif /* __MATH_BUILTIN_RELOPS */
|
||||||
|
|
||||||
#define signbit(x) \
|
#define signbit(x) __fp_type_select(x, __signbitf, __signbit, __signbitl)
|
||||||
((sizeof (x) == sizeof (float)) ? __signbitf(x) \
|
|
||||||
: (sizeof (x) == sizeof (double)) ? __signbit(x) \
|
|
||||||
: __signbitl(x))
|
|
||||||
|
|
||||||
typedef __double_t double_t;
|
typedef __double_t double_t;
|
||||||
typedef __float_t float_t;
|
typedef __float_t float_t;
|
||||||
@ -175,9 +178,8 @@ int __isfinitef(float) __pure2;
|
|||||||
int __isfinite(double) __pure2;
|
int __isfinite(double) __pure2;
|
||||||
int __isfinitel(long double) __pure2;
|
int __isfinitel(long double) __pure2;
|
||||||
int __isinff(float) __pure2;
|
int __isinff(float) __pure2;
|
||||||
|
int __isinf(double) __pure2;
|
||||||
int __isinfl(long double) __pure2;
|
int __isinfl(long double) __pure2;
|
||||||
int __isnanf(float) __pure2;
|
|
||||||
int __isnanl(long double) __pure2;
|
|
||||||
int __isnormalf(float) __pure2;
|
int __isnormalf(float) __pure2;
|
||||||
int __isnormal(double) __pure2;
|
int __isnormal(double) __pure2;
|
||||||
int __isnormall(long double) __pure2;
|
int __isnormall(long double) __pure2;
|
||||||
@ -185,6 +187,27 @@ int __signbit(double) __pure2;
|
|||||||
int __signbitf(float) __pure2;
|
int __signbitf(float) __pure2;
|
||||||
int __signbitl(long double) __pure2;
|
int __signbitl(long double) __pure2;
|
||||||
|
|
||||||
|
static __inline int
|
||||||
|
__inline_isnan(double __x)
|
||||||
|
{
|
||||||
|
|
||||||
|
return (__x != __x);
|
||||||
|
}
|
||||||
|
|
||||||
|
static __inline int
|
||||||
|
__inline_isnanf(float __x)
|
||||||
|
{
|
||||||
|
|
||||||
|
return (__x != __x);
|
||||||
|
}
|
||||||
|
|
||||||
|
static __inline int
|
||||||
|
__inline_isnanl(long double __x)
|
||||||
|
{
|
||||||
|
|
||||||
|
return (__x != __x);
|
||||||
|
}
|
||||||
|
|
||||||
double acos(double);
|
double acos(double);
|
||||||
double asin(double);
|
double asin(double);
|
||||||
double atan(double);
|
double atan(double);
|
||||||
@ -227,8 +250,6 @@ double expm1(double);
|
|||||||
double fma(double, double, double);
|
double fma(double, double, double);
|
||||||
double hypot(double, double);
|
double hypot(double, double);
|
||||||
int ilogb(double) __pure2;
|
int ilogb(double) __pure2;
|
||||||
int (isinf)(double) __pure2;
|
|
||||||
int (isnan)(double) __pure2;
|
|
||||||
double lgamma(double);
|
double lgamma(double);
|
||||||
long long llrint(double);
|
long long llrint(double);
|
||||||
long long llround(double);
|
long long llround(double);
|
||||||
|
Loading…
Reference in New Issue
Block a user