Updating the new `System.MathF` calls which already existed in `System.Math` to call...
authorTanner Gooding <tannergooding@users.noreply.github.com>
Wed, 19 Oct 2016 19:15:21 +0000 (12:15 -0700)
committerJan Vorlicek <janvorli@microsoft.com>
Wed, 19 Oct 2016 19:15:21 +0000 (21:15 +0200)
* Updating the new `System.MathF` calls which already existed in `System.Math` to call the `System.Math` implementation.
* Removing the FCALL entry for MathF.Abs

Commit migrated from https://github.com/dotnet/coreclr/commit/841155bca0f1fe0202fd53833e476980e398dab7

src/coreclr/src/mscorlib/src/System/MathF.cs
src/coreclr/src/vm/ecalllist.h

index bca5559..2514eee 100644 (file)
@@ -33,8 +33,7 @@ namespace System {
         public const float E = 2.71828183f;
 
         [System.Security.SecuritySafeCritical]  // auto-generated
-        [MethodImplAttribute(MethodImplOptions.InternalCall)]
-        public static extern float Abs(float x);
+        public static float Abs(float x) => Math.Abs(x);
 
         [System.Security.SecuritySafeCritical]  // auto-generated
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
@@ -157,10 +156,10 @@ namespace System {
         public static extern float Log10(float x);
 
         [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
-        public static float Max(float x, float y) => ((x > y) || float.IsNaN(x)) ? x : y;
+        public static float Max(float x, float y) => Math.Max(x, y);
 
         [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
-        public static float Min(float x, float y) => ((x < y) || float.IsNaN(x)) ? x : y;
+        public static float Min(float x, float y) => Math.Min(x, y);
 
         [System.Security.SecuritySafeCritical]  // auto-generated
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
@@ -208,23 +207,7 @@ namespace System {
             return InternalRound(x, 0, mode);
         }
 
-        public static int Sign(float x)
-        {
-            if (x < 0)
-            {
-                return -1;
-            }
-            else if (x > 0)
-            {
-                return 1;
-            }
-            else if (x == 0)
-            {
-                return 0;
-            }
-
-            throw new ArithmeticException(Environment.GetResourceString("Arithmetic_NaN"));
-        }
+        public static int Sign(float x) => Math.Sign(x);
 
         [System.Security.SecuritySafeCritical]  // auto-generated
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
index 2277b03..ea0cad3 100644 (file)
@@ -1252,7 +1252,6 @@ FCFuncStart(gMathFuncs)
 FCFuncEnd()
 
 FCFuncStart(gMathFFuncs)
-    FCIntrinsic("Abs", COMSingle::Abs, CORINFO_INTRINSIC_Abs)
     FCIntrinsic("Acos", COMSingle::Acos, CORINFO_INTRINSIC_Acos)
     FCIntrinsic("Asin", COMSingle::Asin, CORINFO_INTRINSIC_Asin)
     FCIntrinsic("Atan", COMSingle::Atan, CORINFO_INTRINSIC_Atan)