Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.
Closed
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/classlibnative/bcltype/arrayhelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class ArrayHelpers
template <class REAL>
static unsigned int NaNPrepass(REAL keys[], REAL items[], unsigned int left, unsigned int right) {
for (unsigned int i = left; i <= right; i++) {
if (_isnan(keys[i])) {
if (isnan(keys[i])) {
REAL temp = keys[left];
keys[left] = keys[i];
keys[i] = temp;
Expand Down
18 changes: 9 additions & 9 deletions src/classlibnative/float/floatnative.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,10 +267,10 @@ FCIMPL2_VV(double, COMDouble::PowHelper, double x, double y)
double r1;

// TODO: we can get rid following code if VC fixes pow function someday.
if(_isnan(y)) {
if(isnan(y)) {
return y; // IEEE 754-2008: NaN payload must be preserved
}
if(_isnan(x)) {
if(isnan(x)) {
return x; // IEEE 754-2008: NaN payload must be preserved
}
if(IS_DBL_INFINITY(y)) {
Expand Down Expand Up @@ -348,7 +348,7 @@ void assertDoublesWithinRange(double r1, double r2)
{
WRAPPER_NO_CONTRACT;

if (_finite(r1) && _finite(r2))
if (isfinite(r1) && isfinite(r2))
{
// Both numbers are finite--we need to check that they are close to
// each other. If they are large (> 1), the error could also be large,
Expand All @@ -359,7 +359,7 @@ void assertDoublesWithinRange(double r1, double r2)

assert((error < (EPSILON * norm)) || (error < EPSILON));
}
else if (!_isnan(r1) && !_isnan(r2))
else if (!isnan(r1) && !isnan(r2))
{
// At least one of r1 and r2 is infinite, so when multiplied by
// (1 + EPSILON) they should be the same infinity.
Expand All @@ -381,10 +381,10 @@ FCIMPL2_VV(double, COMDouble::Pow, double x, double y)

double r1, r2;

if(_isnan(y)) {
if(isnan(y)) {
return y; // IEEE 754-2008: NaN payload must be preserved
}
if(_isnan(x)) {
if(isnan(x)) {
return x; // IEEE 754-2008: NaN payload must be preserved
}

Expand Down Expand Up @@ -423,10 +423,10 @@ FCIMPL2_VV(double, COMDouble::Pow, double x, double y)

double r1;

if(_isnan(y)) {
if(isnan(y)) {
return y; // IEEE 754-2008: NaN payload must be preserved
}
if(_isnan(x)) {
if(isnan(x)) {
return x; // IEEE 754-2008: NaN payload must be preserved
}

Expand Down Expand Up @@ -483,7 +483,7 @@ FCIMPL1_V(double, COMDouble::Round, double d)
flrTempVal -= 1.0;
}
}
flrTempVal = _copysign(flrTempVal, d);
flrTempVal = copysign(flrTempVal, d);
return flrTempVal;
FCIMPLEND
#endif // defined(_TARGET_X86_)
Expand Down
10 changes: 5 additions & 5 deletions src/jit/assertionprop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -982,7 +982,7 @@ unsigned Compiler::optCreateAssertion(GenTreePtr op1, GenTreePtr op2,
{
noway_assert(op2->gtOper == GT_CNS_DBL);
/* If we have an NaN value then don't record it */
if (_isnan(op2->gtDblCon.gtDconVal))
if (isnan(op2->gtDblCon.gtDconVal))
{
goto DONE_ASSERTION; // Don't make an assertion
}
Expand Down Expand Up @@ -1322,8 +1322,8 @@ bool Compiler::optAssertionVnInvolvesNan(AssertionDsc* assertion)
if (vnStore->IsVNConstant(vns[i]))
{
var_types type = vnStore->TypeOfVN(vns[i]);
if ((type == TYP_FLOAT && _isnan(vnStore->ConstantValue<float >(vns[i])) != 0) ||
(type == TYP_DOUBLE && _isnan(vnStore->ConstantValue<double>(vns[i])) != 0))
if ((type == TYP_FLOAT && isnan(vnStore->ConstantValue<float >(vns[i])) != 0) ||
(type == TYP_DOUBLE && isnan(vnStore->ConstantValue<double>(vns[i])) != 0))
{
return true;
}
Expand Down Expand Up @@ -2769,15 +2769,15 @@ GenTreePtr Compiler::optAssertionPropGlobal_RelOp(EXPSET_TP assertions, const Ge
// which will yield a false correctly. Instead if IL had "op1 != NaN", then we already
// made op1 NaN which will yield a true correctly. Note that this is irrespective of the
// assertion we have made.
allowReverse = (_isnan(constant) == 0);
allowReverse = (isnan(constant) == 0);
}
else if (op1->TypeGet() == TYP_FLOAT)
{
float constant = vnStore->ConstantValue<float>(vnCns);
op1->ChangeOperConst(GT_CNS_DBL);
op1->gtDblCon.gtDconVal = constant;
// See comments for TYP_DOUBLE.
allowReverse = (_isnan(constant) == 0);
allowReverse = (isnan(constant) == 0);
}
else if (op1->TypeGet() == TYP_REF)
{
Expand Down
8 changes: 4 additions & 4 deletions src/jit/gentree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9602,8 +9602,8 @@ GenTreePtr Compiler::gtFoldExprConst(GenTreePtr tree)

assert (genActualType(tree->CastToType()) == tree->gtType);

if ((op1->gtType == TYP_FLOAT && !_finite(forceCastToFloat(d1))) ||
(op1->gtType == TYP_DOUBLE && !_finite(d1)))
if ((op1->gtType == TYP_FLOAT && !isfinite(forceCastToFloat(d1))) ||
(op1->gtType == TYP_DOUBLE && !isfinite(d1)))
{
// The floating point constant is not finite. The ECMA spec says, in
// III 3.27, that "...if overflow occurs converting a floating point type
Expand Down Expand Up @@ -9643,7 +9643,7 @@ GenTreePtr Compiler::gtFoldExprConst(GenTreePtr tree)
case TYP_FLOAT:
case TYP_DOUBLE:
if (op1->gtType == TYP_FLOAT)
d1 = forceCastToFloat(d1); // it's only !_finite() after this conversion
d1 = forceCastToFloat(d1); // it's only !isfinite() after this conversion
goto CNS_DOUBLE;
default:
unreached();
Expand Down Expand Up @@ -10385,7 +10385,7 @@ GenTreePtr Compiler::gtFoldExprConst(GenTreePtr tree)
* For unordered operations (i.e. the GTF_RELOP_NAN_UN flag is set)
* the result is always true - return 1. */

if (_isnan(d1) || _isnan(d2))
if (isnan(d1) || isnan(d2))
{
#ifdef DEBUG
if (verbose)
Expand Down
4 changes: 2 additions & 2 deletions src/jit/valuenum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -956,8 +956,8 @@ ValueNum ValueNumStore::VNForFunc(var_types typ, VNFunc func, ValueNum arg0VN, V
// comparison would return false, an unordered comparison
// will return true if any operands are a NaN. We only perform
// ordered NaN comparison in EvalComparison.
if ((arg0IsFloating && _isnan(GetConstantDouble(arg0VN))) ||
(arg1IsFloating && _isnan(GetConstantDouble(arg1VN))))
if ((arg0IsFloating && isnan(GetConstantDouble(arg0VN))) ||
(arg1IsFloating && isnan(GetConstantDouble(arg1VN))))
{
canFold = false;
}
Expand Down
44 changes: 5 additions & 39 deletions src/pal/inc/pal.h
Original file line number Diff line number Diff line change
Expand Up @@ -6003,14 +6003,6 @@ CoCreateGuid(OUT GUID * pguid);
#define ungetc PAL_ungetc
#define setvbuf PAL_setvbuf
#define atol PAL_atol
#define acos PAL_acos
#define asin PAL_asin
#define atan2 PAL_atan2
#define exp PAL_exp
#define labs PAL_labs
#define log PAL_log
#define log10 PAL_log10
#define pow PAL_pow
#define malloc PAL_malloc
#define free PAL_free
#define mkstemp PAL_mkstemp
Expand All @@ -6023,6 +6015,9 @@ CoCreateGuid(OUT GUID * pguid);
#define _wcstoui64 PAL__wcstoui64
#define _flushall PAL__flushall

// See <pal_math.h> for the method definitions
// #include <pal_math.h> is below with the forward declarations

#ifdef _AMD64_
#define _mm_getcsr PAL__mm_getcsr
#define _mm_setcsr PAL__mm_setcsr
Expand Down Expand Up @@ -6207,40 +6202,11 @@ unsigned int __cdecl _rotr(unsigned int value, int shift)
}

PALIMPORT int __cdecl abs(int);
PALIMPORT double __cdecl fabs(double);
#ifndef PAL_STDCPP_COMPAT
PALIMPORT LONG __cdecl labs(LONG);
PALIMPORT double __cdecl fabs(double);
#endif // !PAL_STDCPP_COMPAT
PALIMPORT long __cdecl labs(long);
// clang complains if this is declared with __int64
PALIMPORT long long __cdecl llabs(long long);

PALIMPORT double __cdecl sqrt(double);
PALIMPORT double __cdecl log(double);
PALIMPORT double __cdecl log10(double);
PALIMPORT double __cdecl exp(double);
PALIMPORT double __cdecl pow(double, double);
PALIMPORT double __cdecl acos(double);
PALIMPORT double __cdecl asin(double);
PALIMPORT double __cdecl atan(double);
PALIMPORT double __cdecl atan2(double,double);
PALIMPORT double __cdecl cos(double);
PALIMPORT double __cdecl sin(double);
PALIMPORT double __cdecl tan(double);
PALIMPORT double __cdecl cosh(double);
PALIMPORT double __cdecl sinh(double);
PALIMPORT double __cdecl tanh(double);
PALIMPORT double __cdecl fmod(double, double);
PALIMPORT float __cdecl fmodf(float, float);
PALIMPORT double __cdecl floor(double);
PALIMPORT double __cdecl ceil(double);
PALIMPORT float __cdecl fabsf(float);
PALIMPORT double __cdecl modf(double, double *);
PALIMPORT float __cdecl modff(float, float *);

PALIMPORT int __cdecl _finite(double);
PALIMPORT int __cdecl _isnan(double);
PALIMPORT double __cdecl _copysign(double, double);
#include <pal_math.h>

#ifndef PAL_STDCPP_COMPAT

Expand Down
Loading