diff --git a/src/Numerics/Euclid.cs b/src/Numerics/Euclid.cs index 0d9c16d0..f4c04e34 100644 --- a/src/Numerics/Euclid.cs +++ b/src/Numerics/Euclid.cs @@ -30,6 +30,7 @@ using System; using System.Collections.Generic; using System.Numerics; +using System.Runtime.CompilerServices; namespace MathNet.Numerics { @@ -41,6 +42,9 @@ namespace MathNet.Numerics /// /// Canonical Modulus. The result has the sign of the divisor. /// +#if !NET40 + [MethodImpl(MethodImplOptions.AggressiveInlining)] +#endif public static double Modulus(double dividend, double divisor) { return ((dividend%divisor) + divisor)%divisor; @@ -49,6 +53,9 @@ namespace MathNet.Numerics /// /// Canonical Modulus. The result has the sign of the divisor. /// +#if !NET40 + [MethodImpl(MethodImplOptions.AggressiveInlining)] +#endif public static float Modulus(float dividend, float divisor) { return ((dividend%divisor) + divisor)%divisor; @@ -57,6 +64,9 @@ namespace MathNet.Numerics /// /// Canonical Modulus. The result has the sign of the divisor. /// +#if !NET40 + [MethodImpl(MethodImplOptions.AggressiveInlining)] +#endif public static int Modulus(int dividend, int divisor) { return ((dividend%divisor) + divisor)%divisor; @@ -65,6 +75,9 @@ namespace MathNet.Numerics /// /// Canonical Modulus. The result has the sign of the divisor. /// +#if !NET40 + [MethodImpl(MethodImplOptions.AggressiveInlining)] +#endif public static long Modulus(long dividend, long divisor) { return ((dividend%divisor) + divisor)%divisor; @@ -73,6 +86,9 @@ namespace MathNet.Numerics /// /// Canonical Modulus. The result has the sign of the divisor. /// +#if !NET40 + [MethodImpl(MethodImplOptions.AggressiveInlining)] +#endif public static BigInteger Modulus(BigInteger dividend, BigInteger divisor) { return ((dividend%divisor) + divisor)%divisor; @@ -81,6 +97,9 @@ namespace MathNet.Numerics /// /// Remainder (% operator). The result has the sign of the dividend. /// +#if !NET40 + [MethodImpl(MethodImplOptions.AggressiveInlining)] +#endif public static double Remainder(double dividend, double divisor) { return dividend%divisor; @@ -89,6 +108,9 @@ namespace MathNet.Numerics /// /// Remainder (% operator). The result has the sign of the dividend. /// +#if !NET40 + [MethodImpl(MethodImplOptions.AggressiveInlining)] +#endif public static float Remainder(float dividend, float divisor) { return dividend%divisor; @@ -97,6 +119,9 @@ namespace MathNet.Numerics /// /// Remainder (% operator). The result has the sign of the dividend. /// +#if !NET40 + [MethodImpl(MethodImplOptions.AggressiveInlining)] +#endif public static int Remainder(int dividend, int divisor) { return dividend%divisor; @@ -105,6 +130,9 @@ namespace MathNet.Numerics /// /// Remainder (% operator). The result has the sign of the dividend. /// +#if !NET40 + [MethodImpl(MethodImplOptions.AggressiveInlining)] +#endif public static long Remainder(long dividend, long divisor) { return dividend%divisor; @@ -113,6 +141,9 @@ namespace MathNet.Numerics /// /// Remainder (% operator). The result has the sign of the dividend. /// +#if !NET40 + [MethodImpl(MethodImplOptions.AggressiveInlining)] +#endif public static BigInteger Remainder(BigInteger dividend, BigInteger divisor) { return dividend%divisor; @@ -123,6 +154,9 @@ namespace MathNet.Numerics /// /// The number to very whether it's even. /// True if and only if it is an even number. +#if !NET40 + [MethodImpl(MethodImplOptions.AggressiveInlining)] +#endif public static bool IsEven(this int number) { return (number & 0x1) == 0x0; @@ -133,6 +167,9 @@ namespace MathNet.Numerics /// /// The number to very whether it's even. /// True if and only if it is an even number. +#if !NET40 + [MethodImpl(MethodImplOptions.AggressiveInlining)] +#endif public static bool IsEven(this long number) { return (number & 0x1) == 0x0; @@ -143,6 +180,9 @@ namespace MathNet.Numerics /// /// The number to very whether it's odd. /// True if and only if it is an odd number. +#if !NET40 + [MethodImpl(MethodImplOptions.AggressiveInlining)] +#endif public static bool IsOdd(this int number) { return (number & 0x1) == 0x1; @@ -153,6 +193,9 @@ namespace MathNet.Numerics /// /// The number to very whether it's odd. /// True if and only if it is an odd number. +#if !NET40 + [MethodImpl(MethodImplOptions.AggressiveInlining)] +#endif public static bool IsOdd(this long number) { return (number & 0x1) == 0x1; @@ -163,6 +206,9 @@ namespace MathNet.Numerics /// /// The number to very whether it's a power of two. /// True if and only if it is a power of two. +#if !NET40 + [MethodImpl(MethodImplOptions.AggressiveInlining)] +#endif public static bool IsPowerOfTwo(this int number) { return number > 0 && (number & (number - 1)) == 0x0; @@ -173,6 +219,9 @@ namespace MathNet.Numerics /// /// The number to very whether it's a power of two. /// True if and only if it is a power of two. +#if !NET40 + [MethodImpl(MethodImplOptions.AggressiveInlining)] +#endif public static bool IsPowerOfTwo(this long number) { return number > 0 && (number & (number - 1)) == 0x0;