Skip to content

Commit

Permalink
Fix the RV64 and LA64 builds
Browse files Browse the repository at this point in the history
  • Loading branch information
tannergooding committed May 10, 2024
1 parent 30dc925 commit 67a391b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 26 deletions.
20 changes: 7 additions & 13 deletions src/libraries/System.Private.CoreLib/src/System/Math.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1195,15 +1195,12 @@ public static double MinMagnitude(double x, double y)
/// <para>On ARM64 hardware this may use the <c>FRECPE</c> instruction which performs a single Newton-Raphson iteration.</para>
/// <para>On hardware without specialized support, this may just return <c>1.0 / d</c>.</para>
/// </remarks>
[Intrinsic]
public static double ReciprocalEstimate(double d)
{
#if MONO
return 1.0 / d;
public static double ReciprocalEstimate(double d) => 1.0 / d;
#else
return ReciprocalEstimate(d);
[Intrinsic]
public static double ReciprocalEstimate(double d) => ReciprocalEstimate(d);
#endif
}

/// <summary>Returns an estimate of the reciprocal square root of a specified number.</summary>
/// <param name="d">The number whose reciprocal square root is to be estimated.</param>
Expand All @@ -1212,15 +1209,12 @@ public static double ReciprocalEstimate(double d)
/// <para>On ARM64 hardware this may use the <c>FRSQRTE</c> instruction which performs a single Newton-Raphson iteration.</para>
/// <para>On hardware without specialized support, this may just return <c>1.0 / Sqrt(d)</c>.</para>
/// </remarks>
[Intrinsic]
public static double ReciprocalSqrtEstimate(double d)
{
#if MONO
return 1.0 / Sqrt(d);
#if MONO || TARGET_RISCV64 || TARGET_LOONGARCH64
public static double ReciprocalSqrtEstimate(double d) => 1.0 / Sqrt(d);
#else
return ReciprocalSqrtEstimate(d);
[Intrinsic]
public static double ReciprocalSqrtEstimate(double d) => ReciprocalSqrtEstimate(d);
#endif
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static decimal Round(decimal d)
Expand Down
20 changes: 7 additions & 13 deletions src/libraries/System.Private.CoreLib/src/System/MathF.cs
Original file line number Diff line number Diff line change
Expand Up @@ -313,15 +313,12 @@ public static float MinMagnitude(float x, float y)
/// <para>On ARM64 hardware this may use the <c>FRECPE</c> instruction which performs a single Newton-Raphson iteration.</para>
/// <para>On hardware without specialized support, this may just return <c>1.0 / x</c>.</para>
/// </remarks>
[Intrinsic]
public static float ReciprocalEstimate(float x)
{
#if MONO
return 1.0f / x;
public static float ReciprocalEstimate(float x) => 1.0f / x;
#else
return ReciprocalEstimate(x);
[Intrinsic]
public static float ReciprocalEstimate(float x) => ReciprocalEstimate(x);
#endif
}

/// <summary>Returns an estimate of the reciprocal square root of a specified number.</summary>
/// <param name="x">The number whose reciprocal square root is to be estimated.</param>
Expand All @@ -331,15 +328,12 @@ public static float ReciprocalEstimate(float x)
/// <para>On ARM64 hardware this may use the <c>FRSQRTE</c> instruction which performs a single Newton-Raphson iteration.</para>
/// <para>On hardware without specialized support, this may just return <c>1.0 / Sqrt(x)</c>.</para>
/// </remarks>
[Intrinsic]
public static float ReciprocalSqrtEstimate(float x)
{
#if MONO
return 1.0f / Sqrt(x);
#if MONO || TARGET_RISCV64 || TARGET_LOONGARCH64
public static float ReciprocalSqrtEstimate(float x) => 1.0f / Sqrt(x);
#else
return ReciprocalSqrtEstimate(x);
[Intrinsic]
public static float ReciprocalSqrtEstimate(float x) => ReciprocalSqrtEstimate(x);
#endif
}

[Intrinsic]
public static float Round(float x)
Expand Down

0 comments on commit 67a391b

Please sign in to comment.