Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid using _FInf etc. in numeric_limits.h after MSVC's STL removes them #474

Merged
merged 1 commit into from
Jul 22, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions include/EASTL/numeric_limits.h
Original file line number Diff line number Diff line change
Expand Up @@ -1435,6 +1435,19 @@ namespace eastl
static value_type round_error()
{ return 0.5f; }

#if defined(_MSVC_STL_UPDATE) && _MSVC_STL_UPDATE >= 202206L // If using a recent version of MSVC's STL...
static value_type infinity()
{ return __builtin_huge_valf(); }

static value_type quiet_NaN()
{ return __builtin_nanf("0"); }

static value_type signaling_NaN()
{ return __builtin_nansf("1"); }

static value_type denorm_min()
{ return FLT_TRUE_MIN; }
#else
static value_type infinity()
{ return _CSTD _FInf._Float; }

Expand All @@ -1446,6 +1459,7 @@ namespace eastl

static value_type denorm_min()
{ return _CSTD _FDenorm._Float; }
#endif

#endif
};
Expand Down Expand Up @@ -1553,6 +1567,19 @@ namespace eastl
static value_type round_error()
{ return 0.5f; }

#if defined(_MSVC_STL_UPDATE) && _MSVC_STL_UPDATE >= 202206L // If using a recent version of MSVC's STL...
static value_type infinity()
{ return __builtin_huge_val(); }

static value_type quiet_NaN()
{ return __builtin_nan("0"); }

static value_type signaling_NaN()
{ return __builtin_nans("1"); }

static value_type denorm_min()
{ return DBL_TRUE_MIN; }
#else
static value_type infinity()
{ return _CSTD _Inf._Double; }

Expand All @@ -1564,6 +1591,7 @@ namespace eastl

static value_type denorm_min()
{ return _CSTD _Denorm._Double; }
#endif

#endif
};
Expand Down Expand Up @@ -1671,6 +1699,19 @@ namespace eastl
static value_type round_error()
{ return 0.5f; }

#if defined(_MSVC_STL_UPDATE) && _MSVC_STL_UPDATE >= 202206L // If using a recent version of MSVC's STL...
static value_type infinity()
{ return __builtin_huge_val(); }

static value_type quiet_NaN()
{ return __builtin_nan("0"); }

static value_type signaling_NaN()
{ return __builtin_nans("1"); }

static value_type denorm_min()
{ return LDBL_TRUE_MIN; }
#else
static value_type infinity()
{ return _CSTD _LInf._Long_double; }

Expand All @@ -1682,6 +1723,7 @@ namespace eastl

static value_type denorm_min()
{ return _CSTD _LDenorm._Long_double; }
#endif

#endif
};
Expand Down