From 1881b79bcde9db3ad31ee291ee88872c6e206bb8 Mon Sep 17 00:00:00 2001 From: dotnet-bot Date: Thu, 20 Oct 2016 16:18:59 -0700 Subject: [PATCH] Updating the macro redefinition for _isnanf and _copysignf in floatsingle.cpp. This is required for the scenario when the system CRT header files are used instead of the newer MSVCRT header files. [tfs-changeset: 1634419] Commit migrated from https://github.com/dotnet/coreclr/commit/890e5f93914396ac2cdd502809d15984d2d4db15 --- src/coreclr/src/classlibnative/float/floatsingle.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/coreclr/src/classlibnative/float/floatsingle.cpp b/src/coreclr/src/classlibnative/float/floatsingle.cpp index ebae724..7e2ea0a 100644 --- a/src/coreclr/src/classlibnative/float/floatsingle.cpp +++ b/src/coreclr/src/classlibnative/float/floatsingle.cpp @@ -11,16 +11,21 @@ #define IS_FLT_INFINITY(x) (((*((INT32*)((void*)&x))) & 0x7FFFFFFF) == 0x7F800000) -// Windows x86 and Windows ARM don't define _isnanf() but they do define a generic macro isnan() -#if (defined(_TARGET_X86_) || defined(_TARGET_ARM_) || defined(_TARGET_ARM64_)) && !defined(FEATURE_PAL) && !defined(_isnanf) -#if defined(_TARGET_ARM64_) || defined(_TARGET_ARM_) +// Windows x86 and Windows ARM/ARM64 may not define _isnanf() or _copysignf() but they do +// define _isnan() and _copysign(). We will redirect the macros to these other functions if +// the macro is not defined for the platform. This has the side effect of a possible implicit +// upcasting for arguments passed in and an explicit downcasting for the _copysign() call. +#if (defined(_TARGET_X86_) || defined(_TARGET_ARM_) || defined(_TARGET_ARM64_)) && !defined(FEATURE_PAL) + +#if !defined(_isnanf) #define _isnanf _isnan -#else -#define _isnanf isnan #endif + +#if !defined(_copysignf) +#define _copysignf (float)_copysign #endif -# +#endif // The default compilation mode is /fp:precise, which disables floating-point intrinsics. This // default compilation mode has previously caused performance regressions in floating-point code. -- 2.7.4