diff --git a/X10D.Tests/src/Core/SpanTest.cs b/X10D.Tests/src/Core/SpanTest.cs index 957d1cb..743a55e 100644 --- a/X10D.Tests/src/Core/SpanTest.cs +++ b/X10D.Tests/src/Core/SpanTest.cs @@ -223,22 +223,6 @@ internal class SpanTest Assert.That(actual, Is.EqualTo(expected)); } - [Test] - public void PackByteInternal_AdvSimd_ShouldReturnCorrectByte_GivenReadOnlySpan_Using() - { - if (!AdvSimd.IsSupported) - { - return; - } - - const byte expected = 0b00110011; - ReadOnlySpan span = stackalloc bool[8] {true, true, false, false, true, true, false, false}; - - byte actual = span.PackByteInternal_AdvSimd(); - - Assert.That(actual, Is.EqualTo(expected)); - } - [Test] public void PackInt16_ShouldReturnSameAsPackByte_WhenSpanHasLength8() { @@ -338,26 +322,6 @@ internal class SpanTest Assert.That(actual, Is.EqualTo(expected)); } - [Test] - public void PackInt32Internal_AdvSimd_ShouldReturnCorrectInt32_GivenReadOnlySpan() - { - if (!AdvSimd.IsSupported) - { - return; - } - - const int expected = 0b01010101_10101010_01010101_10101010; - ReadOnlySpan span = stackalloc bool[32] - { - false, true, false, true, false, true, false, true, true, false, true, false, true, false, true, false, false, - true, false, true, false, true, false, true, true, false, true, false, true, false, true, false, - }; - - int actual = span.PackInt32Internal_AdvSimd(); - - Assert.That(actual, Is.EqualTo(expected)); - } - [Test] public void PackInt32_ShouldReturnSameAsPackByte_WhenSpanHasLength8_UsingReadOnlySpan() { diff --git a/X10D/src/Collections/ListExtensions.cs b/X10D/src/Collections/ListExtensions.cs index be53ee8..900fd9f 100644 --- a/X10D/src/Collections/ListExtensions.cs +++ b/X10D/src/Collections/ListExtensions.cs @@ -241,20 +241,9 @@ public static class ListExtensions throw new ArgumentNullException(nameof(source)); } - int start = range.Start.IsFromEnd ? source.Count - range.Start.Value : range.Start.Value; - int end = range.End.IsFromEnd ? source.Count - range.End.Value : range.End.Value; + (int start, int length) = range.GetOffsetAndLength(source.Count); - if (end < start) - { - throw new ArgumentException(ExceptionMessages.EndIndexLessThanStartIndex); - } - - if (end >= source.Count) - { - throw new ArgumentOutOfRangeException(nameof(range), ExceptionMessages.EndIndexGreaterThanCount); - } - - for (int index = end; index >= start; index--) + for (int index = start + length; index >= start; index--) { source.RemoveAt(index); } diff --git a/X10D/src/Core/IntrinsicExtensions.cs b/X10D/src/Core/IntrinsicExtensions.cs index 5a95f5f..7a98d64 100644 --- a/X10D/src/Core/IntrinsicExtensions.cs +++ b/X10D/src/Core/IntrinsicExtensions.cs @@ -29,7 +29,7 @@ public static class IntrinsicExtensions /// A of which remapped back to 0 and 1 based on boolean truthiness. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static Vector64 CorrectBoolean(this Vector64 vector) { Vector64 output = IntrinsicUtility.GetUninitializedVector64(); @@ -64,7 +64,7 @@ public static class IntrinsicExtensions /// A of which remapped back to 0 and 1 based on boolean truthiness. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] [ExcludeFromCodeCoverage] public static Vector128 CorrectBoolean(this Vector128 vector) { @@ -87,7 +87,7 @@ public static class IntrinsicExtensions /// A of which remapped back to 0 and 1 based on boolean truthiness. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] [ExcludeFromCodeCoverage] public static Vector256 CorrectBoolean(this Vector256 vector) { @@ -111,7 +111,7 @@ public static class IntrinsicExtensions /// [Pure] [CLSCompliant(false)] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] [ExcludeFromCodeCoverage] public static Vector128 ReverseElements(this Vector128 vector) { @@ -119,7 +119,7 @@ public static class IntrinsicExtensions } [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] internal static Vector128 CorrectBooleanInternal_Fallback(this Vector128 vector) { Vector128 output = IntrinsicUtility.GetUninitializedVector128(); @@ -134,7 +134,7 @@ public static class IntrinsicExtensions } [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] internal static Vector128 CorrectBooleanInternal_Sse2(this Vector128 vector) { Vector128 cmp = Sse2.CompareEqual(vector, Vector128.Zero); @@ -144,7 +144,7 @@ public static class IntrinsicExtensions } [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] internal static Vector256 CorrectBooleanInternal_Fallback(this Vector256 vector) { Vector256 output = IntrinsicUtility.GetUninitializedVector256(); @@ -159,7 +159,7 @@ public static class IntrinsicExtensions } [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] internal static Vector256 CorrectBooleanInternal_Avx2(this Vector256 vector) { Vector256 cmp = Avx2.CompareEqual(vector, Vector256.Zero); @@ -169,7 +169,7 @@ public static class IntrinsicExtensions } [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] internal static Vector128 ReverseElementsInternal_Fallback(this Vector128 vector) { Vector128 output = IntrinsicUtility.GetUninitializedVector128(); @@ -181,7 +181,7 @@ public static class IntrinsicExtensions } [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] internal static Vector128 ReverseElementsInternal_Sse2(this Vector128 vector) { return Sse2.Shuffle(vector.AsDouble(), vector.AsDouble(), 0b01).AsUInt64(); diff --git a/X10D/src/Core/IntrinsicUtility.cs b/X10D/src/Core/IntrinsicUtility.cs index 76fc41b..73685d1 100644 --- a/X10D/src/Core/IntrinsicUtility.cs +++ b/X10D/src/Core/IntrinsicUtility.cs @@ -31,7 +31,7 @@ public static class IntrinsicUtility /// The truncated product vector. [Pure] [CLSCompliant(false)] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] [ExcludeFromCodeCoverage] public static Vector128 Multiply(Vector128 left, Vector128 right) { @@ -62,7 +62,7 @@ public static class IntrinsicUtility /// [Pure] [CLSCompliant(false)] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] [ExcludeFromCodeCoverage] public static Vector256 Multiply(Vector256 lhs, Vector256 rhs) { @@ -90,7 +90,7 @@ public static class IntrinsicUtility /// A of whose elements is 64-bit truncated product of lhs and rhs. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static Vector128 Multiply(Vector128 lhs, Vector128 rhs) { return Multiply(lhs.AsUInt64(), rhs.AsUInt64()).AsInt64(); @@ -114,7 +114,7 @@ public static class IntrinsicUtility /// A of whose elements is 64-bit truncated product of lhs and rhs. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static Vector256 Multiply(Vector256 lhs, Vector256 rhs) { return Multiply(lhs.AsUInt64(), rhs.AsUInt64()).AsInt64(); @@ -140,7 +140,7 @@ public static class IntrinsicUtility /// elements in lhs and rhs. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] [ExcludeFromCodeCoverage] public static Vector128 HorizontalOr(Vector128 left, Vector128 right) { @@ -171,7 +171,7 @@ public static class IntrinsicUtility /// elements in lhs and rhs. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] [CLSCompliant(false)] public static Vector128 HorizontalOr(Vector128 left, Vector128 right) { @@ -179,21 +179,21 @@ public static class IntrinsicUtility } // Helper methods - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] internal static Vector64 GetUninitializedVector64() where T : struct { Unsafe.SkipInit(out Vector64 output); return output; } - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] internal static Vector128 GetUninitializedVector128() where T : struct { Unsafe.SkipInit(out Vector128 output); return output; } - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] internal static Vector256 GetUninitializedVector256() where T : struct { Unsafe.SkipInit(out Vector256 output); @@ -201,7 +201,7 @@ public static class IntrinsicUtility } [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] internal static Vector128 HorizontalOr_Sse(Vector128 left, Vector128 right) { Vector128 leftSingle = left.AsSingle(); @@ -216,7 +216,7 @@ public static class IntrinsicUtility } [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] internal static Vector128 HorizontalOrInternal_Fallback(Vector128 left, Vector128 right) { Vector128 output = GetUninitializedVector128(); @@ -235,7 +235,7 @@ public static class IntrinsicUtility } [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] internal static Vector128 MultiplyInternal_Fallback(Vector128 left, Vector128 right) { ulong leftInteger1 = Unsafe.As, ulong>(ref left); @@ -252,7 +252,7 @@ public static class IntrinsicUtility } [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] internal static Vector128 MultiplyInternal_Sse2(Vector128 left, Vector128 right) { // https://stackoverflow.com/questions/17863411/sse-multiplication-of-2-64-bit-integers @@ -269,7 +269,7 @@ public static class IntrinsicUtility } [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] internal static Vector256 MultiplyInternal_Fallback(Vector256 left, Vector256 right) { Vector256 output = GetUninitializedVector256(); @@ -285,7 +285,7 @@ public static class IntrinsicUtility } [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] internal static Vector256 MultiplyInternal_Avx2(Vector256 left, Vector256 right) { // https://stackoverflow.com/questions/17863411/sse-multiplication-of-2-64-bit-integers diff --git a/X10D/src/Core/SpanExtensions.cs b/X10D/src/Core/SpanExtensions.cs index b63e354..239c7a5 100644 --- a/X10D/src/Core/SpanExtensions.cs +++ b/X10D/src/Core/SpanExtensions.cs @@ -4,7 +4,6 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Intrinsics; using System.Runtime.Intrinsics.X86; -using System.Runtime.Intrinsics.Arm; using X10D.CompilerServices; #if NET7_0_OR_GREATER @@ -66,47 +65,42 @@ public static class SpanExtensions [MethodImpl(CompilerResources.MethodImplOptions)] public static bool Contains(this ReadOnlySpan span, T value) where T : struct, Enum { - unsafe + switch (Unsafe.SizeOf()) { -#pragma warning disable CS8500 - switch (sizeof(T)) -#pragma warning restore CS8500 - { - case 1: - { - ref byte enums = ref Unsafe.As(ref MemoryMarshal.GetReference(span)); - return MemoryMarshal.CreateSpan(ref enums, span.Length).Contains(Unsafe.As(ref value)); - } + case 1: + { + ref byte enums = ref Unsafe.As(ref MemoryMarshal.GetReference(span)); + return MemoryMarshal.CreateSpan(ref enums, span.Length).Contains(Unsafe.As(ref value)); + } - case 2: - { - ref ushort enums = ref Unsafe.As(ref MemoryMarshal.GetReference(span)); - return MemoryMarshal.CreateSpan(ref enums, span.Length).Contains(Unsafe.As(ref value)); - } + case 2: + { + ref ushort enums = ref Unsafe.As(ref MemoryMarshal.GetReference(span)); + return MemoryMarshal.CreateSpan(ref enums, span.Length).Contains(Unsafe.As(ref value)); + } - case 4: - { - ref uint enums = ref Unsafe.As(ref MemoryMarshal.GetReference(span)); - return MemoryMarshal.CreateSpan(ref enums, span.Length).Contains(Unsafe.As(ref value)); - } + case 4: + { + ref uint enums = ref Unsafe.As(ref MemoryMarshal.GetReference(span)); + return MemoryMarshal.CreateSpan(ref enums, span.Length).Contains(Unsafe.As(ref value)); + } - case 8: - { - ref ulong enums = ref Unsafe.As(ref MemoryMarshal.GetReference(span)); - return MemoryMarshal.CreateSpan(ref enums, span.Length).Contains(Unsafe.As(ref value)); - } + case 8: + { + ref ulong enums = ref Unsafe.As(ref MemoryMarshal.GetReference(span)); + return MemoryMarshal.CreateSpan(ref enums, span.Length).Contains(Unsafe.As(ref value)); + } - // dotcover disable - //NOSONAR - default: + // dotcover disable + //NOSONAR + default: #if NET7_0_OR_GREATER - throw new UnreachableException(ExceptionMessages.EnumSizeIsUnexpected); + throw new UnreachableException(string.Format(ExceptionMessages.EnumSizeIsUnexpected, Unsafe.SizeOf())); #else - throw new ArgumentException(ExceptionMessages.EnumSizeIsUnexpected); + throw new ArgumentException(string.Format(ExceptionMessages.EnumSizeIsUnexpected, Unsafe.SizeOf())); #endif - //NOSONAR - // dotcover enable - } + //NOSONAR + // dotcover enable } } @@ -154,11 +148,6 @@ public static class SpanExtensions return PackByteInternal_Sse2(source); } - if (AdvSimd.IsSupported) - { - return PackByteInternal_AdvSimd(source); - } - return PackByteInternal_Fallback(source); } @@ -263,10 +252,6 @@ public static class SpanExtensions return PackInt32Internal_Sse2(source); } - if (AdvSimd.IsSupported) - { - return PackInt32Internal_AdvSimd(source); - } goto default; default: @@ -392,35 +377,6 @@ public static class SpanExtensions } } - // dotcover disable - //NOSONAR - [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] - internal static int PackInt32Internal_AdvSimd(this ReadOnlySpan source) - { - unsafe - { - fixed (bool* pSource = source) - { - Vector128 vector1 = AdvSimd.LoadVector128((byte*)pSource).CorrectBoolean().AsUInt64(); - Vector128 vector2 = AdvSimd.LoadVector128((byte*)(pSource + 16)).CorrectBoolean().AsUInt64(); - - Vector128 calc1 = IntrinsicUtility.Multiply(IntegerPackingMagicV128, vector1); - Vector128 calc2 = IntrinsicUtility.Multiply(IntegerPackingMagicV128, vector2); - - calc1 = AdvSimd.ShiftRightLogical(calc1, 56); - calc2 = AdvSimd.ShiftRightLogical(calc2, 56); - - Vector128 shift1 = AdvSimd.ShiftLogical(calc1, Vector128.Create(0, 8)); - Vector128 shift2 = AdvSimd.ShiftLogical(calc2, Vector128.Create(16, 24)); - - return (int)(shift1.GetElement(0) | shift1.GetElement(1) | shift2.GetElement(0) | shift2.GetElement(1)); - } - } - } - //NOSONAR - // dotcover enable - [Pure] [MethodImpl(CompilerResources.MethodImplOptions)] internal static int PackInt32Internal_Avx2(this ReadOnlySpan source) @@ -474,22 +430,4 @@ public static class SpanExtensions } } } - - // dotcover disable - //NOSONAR - [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] - internal static byte PackByteInternal_AdvSimd(this ReadOnlySpan source) - { - unsafe - { - fixed (bool* pSource = source) - { - Vector64 load = AdvSimd.LoadVector64((byte*)pSource); - return unchecked((byte)(IntegerPackingMagic * load.CorrectBoolean().AsUInt64().GetElement(0) >> 56)); - } - } - } - //NOSONAR - // dotcover enable } diff --git a/X10D/src/Drawing/ColorExtensions.cs b/X10D/src/Drawing/ColorExtensions.cs index 7e805ac..3d90e05 100644 --- a/X10D/src/Drawing/ColorExtensions.cs +++ b/X10D/src/Drawing/ColorExtensions.cs @@ -27,7 +27,7 @@ public static class ColorExtensions /// When this method returns, contains the component of . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static void Deconstruct(this Color color, out byte a, out byte r, out byte g, out byte b) { a = color.A; @@ -48,7 +48,7 @@ public static class ColorExtensions /// When this method returns, contains the component of . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static void Deconstruct(this Color color, out byte r, out byte g, out byte b) { r = color.R; @@ -63,7 +63,7 @@ public static class ColorExtensions /// The closest . /// Glenn Slayden, https://stackoverflow.com/a/12340136/1467293 [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static ConsoleColor GetClosestConsoleColor(this Color color) { ConsoleColor result = 0; @@ -102,7 +102,7 @@ public static class ColorExtensions /// The color to invert. /// The inverted color. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static Color Inverted(this Color color) { return Color.FromArgb(color.A, 255 - color.R, 255 - color.G, 255 - color.B); @@ -120,7 +120,7 @@ public static class ColorExtensions /// component is . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static Color WithA(this Color color, int a) { return Color.FromArgb(a, color.R, color.G, color.B); @@ -138,7 +138,7 @@ public static class ColorExtensions /// component is . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static Color WithB(this Color color, int b) { return Color.FromArgb(color.A, color.R, color.G, b); @@ -156,7 +156,7 @@ public static class ColorExtensions /// component is . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static Color WithG(this Color color, int g) { return Color.FromArgb(color.A, color.R, g, color.B); @@ -174,7 +174,7 @@ public static class ColorExtensions /// component is . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static Color WithR(this Color color, int r) { return Color.FromArgb(color.A, r, color.G, color.B); diff --git a/X10D/src/Drawing/PointExtensions.cs b/X10D/src/Drawing/PointExtensions.cs index 6d0b7b7..9153c13 100644 --- a/X10D/src/Drawing/PointExtensions.cs +++ b/X10D/src/Drawing/PointExtensions.cs @@ -21,7 +21,7 @@ public static class PointExtensions /// . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool IsOnLine(this Point point, LineF line) { return ((PointF)point).IsOnLine(line); @@ -38,7 +38,7 @@ public static class PointExtensions /// ; otherwise . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool IsOnLine(this Point point, PointF start, PointF end) { return point.IsOnLine(new LineF(start, end)); @@ -55,7 +55,7 @@ public static class PointExtensions /// ; otherwise . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool IsOnLine(this Point point, Vector2 start, Vector2 end) { return point.IsOnLine(new LineF(start, end)); @@ -67,7 +67,7 @@ public static class PointExtensions /// The point to convert. /// The resulting . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static Size ToSize(this Point point) { return new Size(point.X, point.Y); diff --git a/X10D/src/Drawing/PointFExtensions.cs b/X10D/src/Drawing/PointFExtensions.cs index 4207440..bfa0edf 100644 --- a/X10D/src/Drawing/PointFExtensions.cs +++ b/X10D/src/Drawing/PointFExtensions.cs @@ -22,7 +22,7 @@ public static class PointFExtensions /// . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool IsOnLine(this PointF point, LineF line) { (float x1, float x2) = (line.Start.X, line.End.X); @@ -42,7 +42,7 @@ public static class PointFExtensions /// ; otherwise . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool IsOnLine(this PointF point, PointF start, PointF end) { return point.IsOnLine(new LineF(start, end)); @@ -59,7 +59,7 @@ public static class PointFExtensions /// ; otherwise . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool IsOnLine(this PointF point, Vector2 start, Vector2 end) { return point.IsOnLine(new LineF(start, end)); @@ -71,7 +71,7 @@ public static class PointFExtensions /// The point whose components to round. /// The rounded point. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static PointF Round(this PointF point) { return point.Round(1.0f); @@ -84,7 +84,7 @@ public static class PointFExtensions /// The nearest multiple to which the components should be rounded. /// The rounded point. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static PointF Round(this PointF point, float nearest) { float x = point.X.Round(nearest); @@ -98,7 +98,7 @@ public static class PointFExtensions /// The point to convert. /// The resulting . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static SizeF ToSizeF(this PointF point) { return new SizeF(point.X, point.Y); diff --git a/X10D/src/Drawing/SizeExtensions.cs b/X10D/src/Drawing/SizeExtensions.cs index 5276c4b..dcf3058 100644 --- a/X10D/src/Drawing/SizeExtensions.cs +++ b/X10D/src/Drawing/SizeExtensions.cs @@ -17,7 +17,7 @@ public static class SizeExtensions /// The size to convert. /// The resulting . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static Point ToPoint(this Size size) { return new Point(size.Width, size.Height); @@ -29,7 +29,7 @@ public static class SizeExtensions /// The size to convert. /// The resulting . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static PointF ToPointF(this Size size) { return new PointF(size.Width, size.Height); @@ -41,7 +41,7 @@ public static class SizeExtensions /// The size to convert. /// The resulting . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static Vector2 ToVector2(this Size size) { return new Vector2(size.Width, size.Height); diff --git a/X10D/src/ExceptionMessages.Designer.cs b/X10D/src/ExceptionMessages.Designer.cs index 8d6c6b6..f5ba95d 100644 --- a/X10D/src/ExceptionMessages.Designer.cs +++ b/X10D/src/ExceptionMessages.Designer.cs @@ -150,7 +150,7 @@ namespace X10D { } /// - /// Looks up a localized string similar to The enum has a size that is not supported.. + /// Looks up a localized string similar to Enum has unexpected size of {0} bytes.. /// internal static string EnumSizeIsUnexpected { get { diff --git a/X10D/src/ExceptionMessages.resx b/X10D/src/ExceptionMessages.resx index f9dcc1e..5bb74e3 100644 --- a/X10D/src/ExceptionMessages.resx +++ b/X10D/src/ExceptionMessages.resx @@ -145,7 +145,7 @@ Type provided must be an Enum. - The enum has a size that is not supported. + Enum has unexpected size of {0} bytes. The specified object is not a valid type. diff --git a/X10D/src/Math/BigIntegerExtensions.cs b/X10D/src/Math/BigIntegerExtensions.cs index 461db48..b2ab805 100644 --- a/X10D/src/Math/BigIntegerExtensions.cs +++ b/X10D/src/Math/BigIntegerExtensions.cs @@ -36,7 +36,7 @@ public static class BigIntegerExtensions /// For example, the digital root of 239 is 5: 2 + 3 + 9 = 14, then 1 + 4 = 5. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static int DigitalRoot(this BigInteger value) { BigInteger root = BigInteger.Abs(value).Mod(9); @@ -50,7 +50,7 @@ public static class BigIntegerExtensions /// The factorial of . /// is less than 0. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static BigInteger Factorial(this BigInteger value) { if (value < 0) @@ -79,7 +79,7 @@ public static class BigIntegerExtensions /// The second value. /// The greatest common factor between and . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static BigInteger GreatestCommonFactor(this BigInteger value, BigInteger other) { while (other != 0) @@ -99,7 +99,7 @@ public static class BigIntegerExtensions /// otherwise. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool IsOdd(this BigInteger value) { return !value.IsEven; @@ -113,7 +113,7 @@ public static class BigIntegerExtensions /// if is prime; otherwise, . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool IsPrime(this BigInteger value) { if (value <= 1) @@ -149,7 +149,7 @@ public static class BigIntegerExtensions /// The second value. /// The lowest common multiple between and . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static BigInteger LowestCommonMultiple(this BigInteger value, BigInteger other) { if (value == 0 || other == 0) @@ -185,7 +185,7 @@ public static class BigIntegerExtensions /// ShreevatsaR, https://stackoverflow.com/a/1082938/1467293 /// CC-BY-SA 2.5 [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static BigInteger Mod(this BigInteger dividend, BigInteger divisor) { BigInteger r = dividend % divisor; @@ -201,7 +201,7 @@ public static class BigIntegerExtensions /// Multiplicative persistence is defined as the recursive digital product until that product is a single digit. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static int MultiplicativePersistence(this BigInteger value) { var persistence = 0; @@ -246,7 +246,7 @@ public static class BigIntegerExtensions /// The exclusive upper bound. /// The wrapped value. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static BigInteger Wrap(this BigInteger value, BigInteger low, BigInteger high) { BigInteger difference = high - low; @@ -260,7 +260,7 @@ public static class BigIntegerExtensions /// The exclusive upper bound. /// The wrapped value. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static BigInteger Wrap(this BigInteger value, BigInteger length) { return ((value % length) + length) % length; diff --git a/X10D/src/Math/ByteExtensions.cs b/X10D/src/Math/ByteExtensions.cs index bc5a121..95d1188 100644 --- a/X10D/src/Math/ByteExtensions.cs +++ b/X10D/src/Math/ByteExtensions.cs @@ -35,7 +35,7 @@ public static class ByteExtensions /// For example, the digital root of 239 is 5: 2 + 3 + 9 = 14, then 1 + 4 = 5. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static byte DigitalRoot(this byte value) { int root = value % 9; @@ -48,7 +48,7 @@ public static class ByteExtensions /// The value whose factorial to compute. /// The factorial of . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static long Factorial(this byte value) { if (value == 0) @@ -72,7 +72,7 @@ public static class ByteExtensions /// The second value. /// The greatest common factor between and . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static byte GreatestCommonFactor(this byte value, byte other) { return (byte)((long)value).GreatestCommonFactor(other); @@ -87,7 +87,7 @@ public static class ByteExtensions /// otherwise. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool IsEven(this byte value) { return (value & 1) == 0; @@ -102,7 +102,7 @@ public static class ByteExtensions /// otherwise. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool IsOdd(this byte value) { return !value.IsEven(); @@ -128,7 +128,7 @@ public static class ByteExtensions /// The second value. /// The lowest common multiple between and . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static byte LowestCommonMultiple(this byte value, byte other) { return (byte)((long)value).LowestCommonMultiple(other); @@ -143,7 +143,7 @@ public static class ByteExtensions /// Multiplicative persistence is defined as the recursive digital product until that product is a single digit. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static int MultiplicativePersistence(this byte value) { return ((long)value).MultiplicativePersistence(); @@ -157,7 +157,7 @@ public static class ByteExtensions /// The exclusive upper bound. /// The wrapped value. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static byte Wrap(this byte value, byte low, byte high) { return (byte)((ulong)value).Wrap(low, high); @@ -170,7 +170,7 @@ public static class ByteExtensions /// The exclusive upper bound. /// The wrapped value. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static byte Wrap(this byte value, byte length) { return (byte)((ulong)value).Wrap(length); diff --git a/X10D/src/Math/ComparableExtensions.cs b/X10D/src/Math/ComparableExtensions.cs index 9aea7fc..c206dca 100644 --- a/X10D/src/Math/ComparableExtensions.cs +++ b/X10D/src/Math/ComparableExtensions.cs @@ -49,7 +49,7 @@ public static class ComparableExtensions /// /// is . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool Between(this T1 value, T2 lower, T3 upper, InclusiveOptions inclusiveOptions = InclusiveOptions.None) where T1 : IComparable, IComparable @@ -106,7 +106,7 @@ public static class ComparableExtensions /// /// is . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static T Clamp(this T value, T lower, T upper) where T : IComparable { @@ -148,7 +148,7 @@ public static class ComparableExtensions /// /// is . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool GreaterThan(this T1 value, T2 other) where T1 : IComparable { @@ -183,7 +183,7 @@ public static class ComparableExtensions /// /// is . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool GreaterThanOrEqualTo(this T1 value, T2 other) where T1 : IComparable { @@ -218,7 +218,7 @@ public static class ComparableExtensions /// /// is . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool LessThan(this T1 value, T2 other) where T1 : IComparable { @@ -253,7 +253,7 @@ public static class ComparableExtensions /// /// is . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool LessThanOrEqualTo(this T1 value, T2 other) where T1 : IComparable { @@ -287,7 +287,7 @@ public static class ComparableExtensions /// /// is . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static T Max(this T value, T other) where T : IComparable { @@ -321,7 +321,7 @@ public static class ComparableExtensions /// /// is . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static T Min(this T value, T other) where T : IComparable { diff --git a/X10D/src/Math/DecimalExtensions.cs b/X10D/src/Math/DecimalExtensions.cs index 6c8bc4f..1aa678d 100644 --- a/X10D/src/Math/DecimalExtensions.cs +++ b/X10D/src/Math/DecimalExtensions.cs @@ -16,7 +16,7 @@ public static class DecimalExtensions /// The number whose square root is to be found. /// The square root of . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static Complex ComplexSqrt(this decimal value) { return Complex.Sqrt((double)value); @@ -31,7 +31,7 @@ public static class DecimalExtensions /// otherwise. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool IsEven(this decimal value) { return value % 2.0m == 0.0m; @@ -46,7 +46,7 @@ public static class DecimalExtensions /// otherwise. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool IsOdd(this decimal value) { return !value.IsEven(); @@ -58,7 +58,7 @@ public static class DecimalExtensions /// The value to round. /// rounded to the nearest whole number. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static decimal Round(this decimal value) { return value.Round(1.0m); @@ -71,7 +71,7 @@ public static class DecimalExtensions /// The nearest multiple to which should be rounded. /// rounded to the nearest multiple of . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static decimal Round(this decimal value, decimal nearest) { return System.Math.Round(value / nearest) * nearest; @@ -84,7 +84,7 @@ public static class DecimalExtensions /// The saturated value. /// This method clamps between 0 and 1. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static decimal Saturate(this decimal value) { return System.Math.Clamp(value, 0.0m, 1.0m); @@ -118,7 +118,7 @@ public static class DecimalExtensions /// /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static int Sign(this decimal value) { return System.Math.Sign(value); @@ -153,7 +153,7 @@ public static class DecimalExtensions /// /// is negative. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static decimal Sqrt(this decimal value) { switch (value) @@ -183,7 +183,7 @@ public static class DecimalExtensions /// The exclusive upper bound. /// The wrapped value. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static decimal Wrap(this decimal value, decimal low, decimal high) { decimal difference = high - low; @@ -197,7 +197,7 @@ public static class DecimalExtensions /// The exclusive upper bound. /// The wrapped value. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static decimal Wrap(this decimal value, decimal length) { return ((value % length) + length) % length; diff --git a/X10D/src/Math/DoubleExtensions.cs b/X10D/src/Math/DoubleExtensions.cs index ac05e03..51a7b7a 100644 --- a/X10D/src/Math/DoubleExtensions.cs +++ b/X10D/src/Math/DoubleExtensions.cs @@ -21,7 +21,7 @@ public static class DoubleExtensions /// is equal to , less than -1, or greater than 1, is returned. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static double Acos(this double value) { return System.Math.Acos(value); @@ -39,7 +39,7 @@ public static class DoubleExtensions /// is less than 1 or equal to , is returned. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static double Acosh(this double value) { return System.Math.Acosh(value); @@ -57,7 +57,7 @@ public static class DoubleExtensions /// is returned. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static double Asin(this double value) { return System.Math.Asin(value); @@ -75,7 +75,7 @@ public static class DoubleExtensions /// , is returned. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static double Asinh(this double value) { return System.Math.Asinh(value); @@ -92,7 +92,7 @@ public static class DoubleExtensions /// is equal to , is returned. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static double Atan(this double value) { return System.Math.Atan(value); @@ -111,7 +111,7 @@ public static class DoubleExtensions /// is returned. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static double Atanh(this double value) { return System.Math.Atanh(value); @@ -123,7 +123,7 @@ public static class DoubleExtensions /// The number whose square root is to be found. /// The square root of . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static Complex ComplexSqrt(this double value) { switch (value) @@ -153,7 +153,7 @@ public static class DoubleExtensions /// . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static double Cos(this double value) { return System.Math.Cos(value); @@ -170,7 +170,7 @@ public static class DoubleExtensions /// , is returned. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static double Cosh(this double value) { return System.Math.Cosh(value); @@ -182,7 +182,7 @@ public static class DoubleExtensions /// The angle in degrees to convert. /// The result of π * / 180. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static double DegreesToRadians(this double value) { return value * (System.Math.PI / 180.0); @@ -197,7 +197,7 @@ public static class DoubleExtensions /// otherwise. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool IsEven(this double value) { return System.Math.Abs(value % 2.0) < double.Epsilon; @@ -212,7 +212,7 @@ public static class DoubleExtensions /// otherwise. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool IsOdd(this double value) { return !value.IsEven(); @@ -224,7 +224,7 @@ public static class DoubleExtensions /// The angle in radians to convert. /// The result of π * / 180. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static double RadiansToDegrees(this double value) { return value * (180.0 / System.Math.PI); @@ -236,7 +236,7 @@ public static class DoubleExtensions /// The value to round. /// rounded to the nearest whole number. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static double Round(this double value) { return value.Round(1.0); @@ -249,7 +249,7 @@ public static class DoubleExtensions /// The nearest multiple to which should be rounded. /// rounded to the nearest multiple of . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static double Round(this double value, double nearest) { return System.Math.Round(value / nearest) * nearest; @@ -262,7 +262,7 @@ public static class DoubleExtensions /// The saturated value. /// This method clamps between 0 and 1. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static double Saturate(this double value) { return System.Math.Clamp(value, 0.0, 1.0); @@ -278,7 +278,7 @@ public static class DoubleExtensions /// . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static double Sin(this double value) { return System.Math.Sin(value); @@ -294,7 +294,7 @@ public static class DoubleExtensions /// . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static double Sinh(this double value) { return System.Math.Sinh(value); @@ -329,7 +329,7 @@ public static class DoubleExtensions /// /// is equal to . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static int Sign(this double value) { return System.Math.Sign(value); @@ -365,7 +365,7 @@ public static class DoubleExtensions /// SLenik https://stackoverflow.com/a/6755197/1467293 /// CC BY-SA 3.0 [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static double Sqrt(this double value) { switch (value) @@ -399,7 +399,7 @@ public static class DoubleExtensions /// . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static double Tan(this double value) { return System.Math.Tan(value); @@ -416,7 +416,7 @@ public static class DoubleExtensions /// , this method returns . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static double Tanh(this double value) { return System.Math.Tanh(value); @@ -430,7 +430,7 @@ public static class DoubleExtensions /// The exclusive upper bound. /// The wrapped value. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static double Wrap(this double value, double low, double high) { double difference = high - low; @@ -444,7 +444,7 @@ public static class DoubleExtensions /// The exclusive upper bound. /// The wrapped value. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static double Wrap(this double value, double length) { return ((value % length) + length) % length; diff --git a/X10D/src/Math/Int16Extensions.cs b/X10D/src/Math/Int16Extensions.cs index d0d354e..aa9fa9b 100644 --- a/X10D/src/Math/Int16Extensions.cs +++ b/X10D/src/Math/Int16Extensions.cs @@ -34,7 +34,7 @@ public static class Int16Extensions /// For example, the digital root of 239 is 5: 2 + 3 + 9 = 14, then 1 + 4 = 5. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static short DigitalRoot(this short value) { short root = System.Math.Abs(value).Mod(9); @@ -48,7 +48,7 @@ public static class Int16Extensions /// The factorial of . /// is less than 0. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static long Factorial(this short value) { if (value < 0) @@ -77,7 +77,7 @@ public static class Int16Extensions /// The second value. /// The greatest common factor between and . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static short GreatestCommonFactor(this short value, short other) { return (short)((long)value).GreatestCommonFactor(other); @@ -92,7 +92,7 @@ public static class Int16Extensions /// otherwise. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool IsEven(this short value) { return (value & 1) == 0; @@ -107,7 +107,7 @@ public static class Int16Extensions /// otherwise. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool IsOdd(this short value) { return !value.IsEven(); @@ -121,7 +121,7 @@ public static class Int16Extensions /// if is prime; otherwise, . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool IsPrime(this short value) { return ((long)value).IsPrime(); @@ -134,7 +134,7 @@ public static class Int16Extensions /// The second value. /// The lowest common multiple between and . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static short LowestCommonMultiple(this short value, short other) { return (short)((long)value).LowestCommonMultiple(other); @@ -155,7 +155,7 @@ public static class Int16Extensions /// ShreevatsaR, https://stackoverflow.com/a/1082938/1467293 /// CC-BY-SA 2.5 [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static short Mod(this short dividend, short divisor) { int r = dividend % divisor; @@ -171,7 +171,7 @@ public static class Int16Extensions /// Multiplicative persistence is defined as the recursive digital product until that product is a single digit. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static int MultiplicativePersistence(this short value) { return ((long)value).MultiplicativePersistence(); @@ -205,7 +205,7 @@ public static class Int16Extensions /// /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static int Sign(this short value) { return System.Math.Sign(value); @@ -219,7 +219,7 @@ public static class Int16Extensions /// The exclusive upper bound. /// The wrapped value. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static short Wrap(this short value, short low, short high) { return (short)((long)value).Wrap(low, high); @@ -232,7 +232,7 @@ public static class Int16Extensions /// The exclusive upper bound. /// The wrapped value. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static short Wrap(this short value, short length) { return (short)((long)value).Wrap(length); diff --git a/X10D/src/Math/Int32Extensions.cs b/X10D/src/Math/Int32Extensions.cs index 95dc664..4d91fcd 100644 --- a/X10D/src/Math/Int32Extensions.cs +++ b/X10D/src/Math/Int32Extensions.cs @@ -34,7 +34,7 @@ public static class Int32Extensions /// For example, the digital root of 239 is 5: 2 + 3 + 9 = 14, then 1 + 4 = 5. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static int DigitalRoot(this int value) { int root = System.Math.Abs(value).Mod(9); @@ -48,7 +48,7 @@ public static class Int32Extensions /// The factorial of . /// is less than 0. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static long Factorial(this int value) { if (value < 0) @@ -77,7 +77,7 @@ public static class Int32Extensions /// The second value. /// The greatest common factor between and . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static int GreatestCommonFactor(this int value, int other) { return (int)((long)value).GreatestCommonFactor(other); @@ -92,7 +92,7 @@ public static class Int32Extensions /// otherwise. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool IsEven(this int value) { return (value & 1) == 0; @@ -107,7 +107,7 @@ public static class Int32Extensions /// otherwise. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool IsOdd(this int value) { return !value.IsEven(); @@ -121,7 +121,7 @@ public static class Int32Extensions /// if is prime; otherwise, . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool IsPrime(this int value) { return ((long)value).IsPrime(); @@ -134,7 +134,7 @@ public static class Int32Extensions /// The second value. /// The lowest common multiple between and . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static int LowestCommonMultiple(this int value, int other) { return (int)((long)value).LowestCommonMultiple(other); @@ -155,7 +155,7 @@ public static class Int32Extensions /// ShreevatsaR, https://stackoverflow.com/a/1082938/1467293 /// CC-BY-SA 2.5 [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static int Mod(this int dividend, int divisor) { int r = dividend % divisor; @@ -171,7 +171,7 @@ public static class Int32Extensions /// Multiplicative persistence is defined as the recursive digital product until that product is a single digit. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static int MultiplicativePersistence(this int value) { return ((long)value).MultiplicativePersistence(); @@ -205,7 +205,7 @@ public static class Int32Extensions /// /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static int Sign(this int value) { return System.Math.Sign(value); @@ -219,7 +219,7 @@ public static class Int32Extensions /// The exclusive upper bound. /// The wrapped value. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static int Wrap(this int value, int low, int high) { return (int)((long)value).Wrap(low, high); @@ -232,7 +232,7 @@ public static class Int32Extensions /// The exclusive upper bound. /// The wrapped value. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static int Wrap(this int value, int length) { return (int)((long)value).Wrap(length); diff --git a/X10D/src/Math/Int64Extensions.cs b/X10D/src/Math/Int64Extensions.cs index 317a379..0c6a530 100644 --- a/X10D/src/Math/Int64Extensions.cs +++ b/X10D/src/Math/Int64Extensions.cs @@ -34,7 +34,7 @@ public static class Int64Extensions /// For example, the digital root of 239 is 5: 2 + 3 + 9 = 14, then 1 + 4 = 5. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static long DigitalRoot(this long value) { long root = System.Math.Abs(value).Mod(9L); @@ -48,7 +48,7 @@ public static class Int64Extensions /// The factorial of . /// is less than 0. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static long Factorial(this long value) { if (value < 0) @@ -77,7 +77,7 @@ public static class Int64Extensions /// The second value. /// The greatest common factor between and . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static long GreatestCommonFactor(this long value, long other) { while (other != 0) @@ -97,7 +97,7 @@ public static class Int64Extensions /// otherwise. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool IsEven(this long value) { return (value & 1) == 0; @@ -112,7 +112,7 @@ public static class Int64Extensions /// otherwise. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool IsOdd(this long value) { return !value.IsEven(); @@ -126,7 +126,7 @@ public static class Int64Extensions /// if is prime; otherwise, . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool IsPrime(this long value) { switch (value) @@ -158,7 +158,7 @@ public static class Int64Extensions /// The second value. /// The lowest common multiple between and . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static long LowestCommonMultiple(this long value, long other) { if (value == 0 || other == 0) @@ -194,7 +194,7 @@ public static class Int64Extensions /// ShreevatsaR, https://stackoverflow.com/a/1082938/1467293 /// CC-BY-SA 2.5 [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static long Mod(this long dividend, long divisor) { long r = dividend % divisor; @@ -210,7 +210,7 @@ public static class Int64Extensions /// Multiplicative persistence is defined as the recursive digital product until that product is a single digit. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static int MultiplicativePersistence(this long value) { var persistence = 0; @@ -275,7 +275,7 @@ public static class Int64Extensions /// /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static int Sign(this long value) { return System.Math.Sign(value); @@ -289,7 +289,7 @@ public static class Int64Extensions /// The exclusive upper bound. /// The wrapped value. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static long Wrap(this long value, long low, long high) { long difference = high - low; @@ -303,7 +303,7 @@ public static class Int64Extensions /// The exclusive upper bound. /// The wrapped value. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static long Wrap(this long value, long length) { return ((value % length) + length) % length; diff --git a/X10D/src/Math/MathUtility.cs b/X10D/src/Math/MathUtility.cs index 995f955..59601ce 100644 --- a/X10D/src/Math/MathUtility.cs +++ b/X10D/src/Math/MathUtility.cs @@ -70,7 +70,7 @@ public static class MathUtility /// The gamma-encoded value to convert. Expected range is [0, 1]. /// The linear value. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static float GammaToLinear(float value) { return GammaToLinear(value, DefaultGammaF); @@ -83,7 +83,7 @@ public static class MathUtility /// The gamma value to use for decoding. /// The linear value. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static float GammaToLinear(float value, float gamma) { return MathF.Pow(value, 1.0f / gamma); @@ -95,7 +95,7 @@ public static class MathUtility /// The gamma-encoded value to convert. Expected range is [0, 1]. /// The linear value. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static double GammaToLinear(double value) { return GammaToLinear(value, DefaultGamma); @@ -108,7 +108,7 @@ public static class MathUtility /// The gamma value to use for decoding. /// The linear value. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static double GammaToLinear(double value, double gamma) { return System.Math.Pow(value, 1.0 / gamma); @@ -123,7 +123,7 @@ public static class MathUtility /// The end of the range. /// A value determined by (alpha - start) / (end - start). [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static float InverseLerp(float alpha, float start, float end) { if (MathF.Abs(start - end) < float.Epsilon) @@ -143,7 +143,7 @@ public static class MathUtility /// The end of the range. /// A value determined by (alpha - start) / (end - start). [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static double InverseLerp(double alpha, double start, double end) { if (System.Math.Abs(start - end) < double.Epsilon) @@ -164,7 +164,7 @@ public static class MathUtility /// The interpolation result as determined by (1 - alpha) * value + alpha * target. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static float Lerp(float value, float target, float alpha) { // rookie mistake: a + t * (b - a) @@ -182,7 +182,7 @@ public static class MathUtility /// The interpolation result as determined by (1 - alpha) * value + alpha * target. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static double Lerp(double value, double target, double alpha) { // rookie mistake: a + t * (b - a) @@ -196,7 +196,7 @@ public static class MathUtility /// The linear value to convert. Expected range is [0, 1]. /// The gamma-encoded value. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static float LinearToGamma(float value) { return LinearToGamma(value, DefaultGammaF); @@ -209,7 +209,7 @@ public static class MathUtility /// The gamma value to use for encoding. /// The gamma-encoded value. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static float LinearToGamma(float value, float gamma) { return MathF.Pow(value, 1.0f / gamma); @@ -221,7 +221,7 @@ public static class MathUtility /// The linear value to convert. Expected range is [0, 1]. /// The gamma-encoded value. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static double LinearToGamma(double value) { return LinearToGamma(value, DefaultGamma); @@ -234,7 +234,7 @@ public static class MathUtility /// The gamma value to use for encoding. /// The gamma-encoded value. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static double LinearToGamma(double value, double gamma) { return System.Math.Pow(value, 1.0 / gamma); @@ -302,7 +302,7 @@ public static class MathUtility /// The new maximum value. /// The scaled value. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static float ScaleRange(float value, float oldMin, float oldMax, float newMin, float newMax) { float oldRange = oldMax - oldMin; @@ -321,7 +321,7 @@ public static class MathUtility /// The new maximum value. /// The scaled value. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static double ScaleRange(double value, double oldMin, double oldMax, double newMin, double newMax) { double oldRange = oldMax - oldMin; diff --git a/X10D/src/Math/SByteExtensions.cs b/X10D/src/Math/SByteExtensions.cs index 050a402..a4c18f5 100644 --- a/X10D/src/Math/SByteExtensions.cs +++ b/X10D/src/Math/SByteExtensions.cs @@ -35,7 +35,7 @@ public static class SByteExtensions /// For example, the digital root of 239 is 5: 2 + 3 + 9 = 14, then 1 + 4 = 5. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static sbyte DigitalRoot(this sbyte value) { int root = System.Math.Abs(value).Mod(9); @@ -49,7 +49,7 @@ public static class SByteExtensions /// The factorial of . /// is less than 0. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static long Factorial(this sbyte value) { if (value < 0) @@ -78,7 +78,7 @@ public static class SByteExtensions /// The second value. /// The greatest common factor between and . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static sbyte GreatestCommonFactor(this sbyte value, sbyte other) { return (sbyte)((long)value).GreatestCommonFactor(other); @@ -93,7 +93,7 @@ public static class SByteExtensions /// otherwise. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool IsEven(this sbyte value) { return (value & 1) == 0; @@ -108,7 +108,7 @@ public static class SByteExtensions /// otherwise. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool IsOdd(this sbyte value) { return !value.IsEven(); @@ -122,7 +122,7 @@ public static class SByteExtensions /// if is prime; otherwise, . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool IsPrime(this sbyte value) { return ((long)value).IsPrime(); @@ -135,7 +135,7 @@ public static class SByteExtensions /// The second value. /// The lowest common multiple between and . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static sbyte LowestCommonMultiple(this sbyte value, sbyte other) { return (sbyte)((long)value).LowestCommonMultiple(other); @@ -156,7 +156,7 @@ public static class SByteExtensions /// ShreevatsaR, https://stackoverflow.com/a/1082938/1467293 /// CC-BY-SA 2.5 [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static sbyte Mod(this sbyte dividend, sbyte divisor) { int r = dividend % divisor; @@ -172,7 +172,7 @@ public static class SByteExtensions /// Multiplicative persistence is defined as the recursive digital product until that product is a single digit. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static int MultiplicativePersistence(this sbyte value) { return ((long)value).MultiplicativePersistence(); @@ -206,7 +206,7 @@ public static class SByteExtensions /// /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static int Sign(this sbyte value) { return System.Math.Sign(value); @@ -220,7 +220,7 @@ public static class SByteExtensions /// The exclusive upper bound. /// The wrapped value. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static sbyte Wrap(this sbyte value, sbyte low, sbyte high) { return (sbyte)((long)value).Wrap(low, high); @@ -233,7 +233,7 @@ public static class SByteExtensions /// The exclusive upper bound. /// The wrapped value. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static sbyte Wrap(this sbyte value, sbyte length) { return (sbyte)((long)value).Wrap(length); diff --git a/X10D/src/Math/SingleExtensions.cs b/X10D/src/Math/SingleExtensions.cs index 296ec03..9e70592 100644 --- a/X10D/src/Math/SingleExtensions.cs +++ b/X10D/src/Math/SingleExtensions.cs @@ -21,7 +21,7 @@ public static class SingleExtensions /// is equal to , less than -1, or greater than 1, is returned. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static float Acos(this float value) { return MathF.Acos(value); @@ -39,7 +39,7 @@ public static class SingleExtensions /// is less than 1 or equal to , is returned. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static float Acosh(this float value) { return MathF.Acosh(value); @@ -57,7 +57,7 @@ public static class SingleExtensions /// is returned. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static float Asin(this float value) { return MathF.Asin(value); @@ -75,7 +75,7 @@ public static class SingleExtensions /// , is returned. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static float Asinh(this float value) { return MathF.Asinh(value); @@ -92,7 +92,7 @@ public static class SingleExtensions /// is equal to , is returned. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static float Atan(this float value) { return MathF.Atan(value); @@ -111,7 +111,7 @@ public static class SingleExtensions /// is returned. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static float Atanh(this float value) { return MathF.Atanh(value); @@ -123,7 +123,7 @@ public static class SingleExtensions /// The number whose square root is to be found. /// The square root of . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static Complex ComplexSqrt(this float value) { switch (value) @@ -153,7 +153,7 @@ public static class SingleExtensions /// . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static float Cos(this float value) { return MathF.Cos(value); @@ -170,7 +170,7 @@ public static class SingleExtensions /// , is returned. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static float Cosh(this float value) { return MathF.Cosh(value); @@ -182,7 +182,7 @@ public static class SingleExtensions /// The angle in degrees to convert. /// The result of π * / 180. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static float DegreesToRadians(this float value) { return value * (MathF.PI / 180.0f); @@ -197,7 +197,7 @@ public static class SingleExtensions /// otherwise. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool IsEven(this float value) { return value % 2 == 0; @@ -212,7 +212,7 @@ public static class SingleExtensions /// otherwise. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool IsOdd(this float value) { return !value.IsEven(); @@ -224,7 +224,7 @@ public static class SingleExtensions /// The angle in radians to convert. /// The result of π * / 180. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static float RadiansToDegrees(this float value) { return value * (180.0f / MathF.PI); @@ -236,7 +236,7 @@ public static class SingleExtensions /// The value to round. /// rounded to the nearest whole number. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static float Round(this float value) { return value.Round(1.0f); @@ -249,7 +249,7 @@ public static class SingleExtensions /// The nearest multiple to which should be rounded. /// rounded to the nearest multiple of . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static float Round(this float value, float nearest) { return MathF.Round(value / nearest) * nearest; @@ -262,7 +262,7 @@ public static class SingleExtensions /// The saturated value. /// This method clamps between 0 and 1. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static float Saturate(this float value) { return System.Math.Clamp(value, 0.0f, 1.0f); @@ -296,7 +296,7 @@ public static class SingleExtensions /// /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static int Sign(this float value) { return MathF.Sign(value); @@ -332,7 +332,7 @@ public static class SingleExtensions /// SLenik https://stackoverflow.com/a/6755197/1467293 /// CC BY-SA 3.0 [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static float Sqrt(this float value) { switch (value) @@ -366,7 +366,7 @@ public static class SingleExtensions /// . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static float Sin(this float value) { return MathF.Sin(value); @@ -382,7 +382,7 @@ public static class SingleExtensions /// . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static float Sinh(this float value) { return MathF.Sinh(value); @@ -398,7 +398,7 @@ public static class SingleExtensions /// . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static float Tan(this float value) { return MathF.Sin(value); @@ -415,7 +415,7 @@ public static class SingleExtensions /// , this method returns . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static float Tanh(this float value) { return MathF.Tanh(value); @@ -429,7 +429,7 @@ public static class SingleExtensions /// The exclusive upper bound. /// The wrapped value. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static float Wrap(this float value, float low, float high) { return (float)((double)value).Wrap(low, high); @@ -442,7 +442,7 @@ public static class SingleExtensions /// The exclusive upper bound. /// The wrapped value. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static float Wrap(this float value, float length) { return (float)((double)value).Wrap(length); diff --git a/X10D/src/Math/UInt16Extensions.cs b/X10D/src/Math/UInt16Extensions.cs index 4d6ea55..bffe978 100644 --- a/X10D/src/Math/UInt16Extensions.cs +++ b/X10D/src/Math/UInt16Extensions.cs @@ -35,7 +35,7 @@ public static class UInt16Extensions /// For example, the digital root of 239 is 5: 2 + 3 + 9 = 14, then 1 + 4 = 5. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static ushort DigitalRoot(this ushort value) { var root = (ushort)(value % 9); @@ -48,7 +48,7 @@ public static class UInt16Extensions /// The value whose factorial to compute. /// The factorial of . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static ulong Factorial(this ushort value) { if (value == 0) @@ -73,7 +73,7 @@ public static class UInt16Extensions /// The second value. /// The greatest common factor between and . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static ushort GreatestCommonFactor(this ushort value, ushort other) { return (ushort)((long)value).GreatestCommonFactor(other); @@ -88,7 +88,7 @@ public static class UInt16Extensions /// otherwise. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool IsEven(this ushort value) { return (value & 1) == 0; @@ -102,7 +102,7 @@ public static class UInt16Extensions /// if is prime; otherwise, . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool IsPrime(this ushort value) { return ((ulong)value).IsPrime(); @@ -117,7 +117,7 @@ public static class UInt16Extensions /// otherwise. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool IsOdd(this ushort value) { return !value.IsEven(); @@ -131,7 +131,7 @@ public static class UInt16Extensions /// The second value. /// The lowest common multiple between and . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static ushort LowestCommonMultiple(this ushort value, ushort other) { return (ushort)((ulong)value).LowestCommonMultiple(other); @@ -146,7 +146,7 @@ public static class UInt16Extensions /// Multiplicative persistence is defined as the recursive digital product until that product is a single digit. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static int MultiplicativePersistence(this ushort value) { return ((ulong)value).MultiplicativePersistence(); @@ -160,7 +160,7 @@ public static class UInt16Extensions /// The exclusive upper bound. /// The wrapped value. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static ushort Wrap(this ushort value, ushort low, ushort high) { return (ushort)((ulong)value).Wrap(low, high); @@ -173,7 +173,7 @@ public static class UInt16Extensions /// The exclusive upper bound. /// The wrapped value. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static ushort Wrap(this ushort value, ushort length) { return (ushort)((ulong)value).Wrap(length); diff --git a/X10D/src/Math/UInt32Extensions.cs b/X10D/src/Math/UInt32Extensions.cs index fdc02fe..3177425 100644 --- a/X10D/src/Math/UInt32Extensions.cs +++ b/X10D/src/Math/UInt32Extensions.cs @@ -35,7 +35,7 @@ public static class UInt32Extensions /// For example, the digital root of 239 is 5: 2 + 3 + 9 = 14, then 1 + 4 = 5. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static uint DigitalRoot(this uint value) { uint root = value % 9; @@ -48,7 +48,7 @@ public static class UInt32Extensions /// The value whose factorial to compute. /// The factorial of . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static ulong Factorial(this uint value) { if (value == 0) @@ -73,7 +73,7 @@ public static class UInt32Extensions /// The second value. /// The greatest common factor between and . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static uint GreatestCommonFactor(this uint value, uint other) { return (uint)((long)value).GreatestCommonFactor(other); @@ -88,7 +88,7 @@ public static class UInt32Extensions /// otherwise. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool IsEven(this uint value) { return (value & 1) == 0; @@ -102,7 +102,7 @@ public static class UInt32Extensions /// if is prime; otherwise, . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool IsPrime(this uint value) { return ((ulong)value).IsPrime(); @@ -117,7 +117,7 @@ public static class UInt32Extensions /// otherwise. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool IsOdd(this uint value) { return !value.IsEven(); @@ -131,7 +131,7 @@ public static class UInt32Extensions /// The second value. /// The lowest common multiple between and . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static uint LowestCommonMultiple(this uint value, uint other) { return (uint)((ulong)value).LowestCommonMultiple(other); @@ -146,7 +146,7 @@ public static class UInt32Extensions /// Multiplicative persistence is defined as the recursive digital product until that product is a single digit. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static int MultiplicativePersistence(this uint value) { return ((ulong)value).MultiplicativePersistence(); @@ -160,7 +160,7 @@ public static class UInt32Extensions /// The exclusive upper bound. /// The wrapped value. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static uint Wrap(this uint value, uint low, uint high) { return (uint)((ulong)value).Wrap(low, high); @@ -173,7 +173,7 @@ public static class UInt32Extensions /// The exclusive upper bound. /// The wrapped value. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static uint Wrap(this uint value, uint length) { return (uint)((ulong)value).Wrap(length); diff --git a/X10D/src/Math/UInt64Extensions.cs b/X10D/src/Math/UInt64Extensions.cs index 26c0be5..029deea 100644 --- a/X10D/src/Math/UInt64Extensions.cs +++ b/X10D/src/Math/UInt64Extensions.cs @@ -35,7 +35,7 @@ public static class UInt64Extensions /// For example, the digital root of 239 is 5: 2 + 3 + 9 = 14, then 1 + 4 = 5. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static ulong DigitalRoot(this ulong value) { ulong root = value % 9; @@ -48,7 +48,7 @@ public static class UInt64Extensions /// The value whose factorial to compute. /// The factorial of . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static ulong Factorial(this ulong value) { if (value == 0) @@ -73,7 +73,7 @@ public static class UInt64Extensions /// The second value. /// The greatest common factor between and . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static ulong GreatestCommonFactor(this ulong value, ulong other) { while (other != 0) @@ -93,7 +93,7 @@ public static class UInt64Extensions /// otherwise. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool IsEven(this ulong value) { return (value & 1) == 0; @@ -107,7 +107,7 @@ public static class UInt64Extensions /// if is prime; otherwise, . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool IsPrime(this ulong value) { switch (value) @@ -141,7 +141,7 @@ public static class UInt64Extensions /// otherwise. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool IsOdd(this ulong value) { return !value.IsEven(); @@ -155,7 +155,7 @@ public static class UInt64Extensions /// The second value. /// The lowest common multiple between and . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static ulong LowestCommonMultiple(this ulong value, ulong other) { if (value == 0 || other == 0) @@ -185,7 +185,7 @@ public static class UInt64Extensions /// Multiplicative persistence is defined as the recursive digital product until that product is a single digit. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static int MultiplicativePersistence(this ulong value) { var persistence = 0; @@ -230,7 +230,7 @@ public static class UInt64Extensions /// The exclusive upper bound. /// The wrapped value. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static ulong Wrap(this ulong value, ulong low, ulong high) { ulong difference = high - low; @@ -244,7 +244,7 @@ public static class UInt64Extensions /// The exclusive upper bound. /// The wrapped value. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static ulong Wrap(this ulong value, ulong length) { return ((value % length) + length) % length; diff --git a/X10D/src/Net/EndPointExtensions.cs b/X10D/src/Net/EndPointExtensions.cs index 05f8755..cb9c42e 100644 --- a/X10D/src/Net/EndPointExtensions.cs +++ b/X10D/src/Net/EndPointExtensions.cs @@ -23,7 +23,7 @@ public static class EndPointExtensions /// /// is . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static string GetHost(this EndPoint endPoint) { if (endPoint is null) @@ -52,7 +52,7 @@ public static class EndPointExtensions /// /// is . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static int GetPort(this EndPoint endPoint) { if (endPoint is null) diff --git a/X10D/src/Net/IPAddressExtensions.cs b/X10D/src/Net/IPAddressExtensions.cs index b2cf6a0..c340468 100644 --- a/X10D/src/Net/IPAddressExtensions.cs +++ b/X10D/src/Net/IPAddressExtensions.cs @@ -20,7 +20,7 @@ public static class IPAddressExtensions /// /// is . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool IsIPv4(this IPAddress address) { if (address is null) @@ -40,7 +40,7 @@ public static class IPAddressExtensions /// /// is . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool IsIPv6(this IPAddress address) { if (address is null) diff --git a/X10D/src/Net/Int16Extensions.cs b/X10D/src/Net/Int16Extensions.cs index 78f8b19..375406a 100644 --- a/X10D/src/Net/Int16Extensions.cs +++ b/X10D/src/Net/Int16Extensions.cs @@ -16,7 +16,7 @@ public static class Int16Extensions /// The value to convert, expressed in host byte order. /// An integer value, expressed in network byte order. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static short HostToNetworkOrder(this short value) { return IPAddress.HostToNetworkOrder(value); @@ -28,7 +28,7 @@ public static class Int16Extensions /// The value to convert, expressed in network byte order. /// An integer value, expressed in host byte order. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static short NetworkToHostOrder(this short value) { return IPAddress.NetworkToHostOrder(value); diff --git a/X10D/src/Net/Int32Extensions.cs b/X10D/src/Net/Int32Extensions.cs index 372932d..8554d63 100644 --- a/X10D/src/Net/Int32Extensions.cs +++ b/X10D/src/Net/Int32Extensions.cs @@ -16,7 +16,7 @@ public static class Int32Extensions /// The value to convert, expressed in host byte order. /// An integer value, expressed in network byte order. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static int HostToNetworkOrder(this int value) { return IPAddress.HostToNetworkOrder(value); @@ -28,7 +28,7 @@ public static class Int32Extensions /// The value to convert, expressed in network byte order. /// An integer value, expressed in host byte order. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static int NetworkToHostOrder(this int value) { return IPAddress.NetworkToHostOrder(value); diff --git a/X10D/src/Net/Int64Extensions.cs b/X10D/src/Net/Int64Extensions.cs index 989947f..3dfd89b 100644 --- a/X10D/src/Net/Int64Extensions.cs +++ b/X10D/src/Net/Int64Extensions.cs @@ -16,7 +16,7 @@ public static class Int64Extensions /// The value to convert, expressed in host byte order. /// An integer value, expressed in network byte order. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static long HostToNetworkOrder(this long value) { return IPAddress.HostToNetworkOrder(value); @@ -28,7 +28,7 @@ public static class Int64Extensions /// The value to convert, expressed in network byte order. /// An integer value, expressed in host byte order. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static long NetworkToHostOrder(this long value) { return IPAddress.NetworkToHostOrder(value); diff --git a/X10D/src/Numerics/ByteExtensions.cs b/X10D/src/Numerics/ByteExtensions.cs index 70f8708..158fcbe 100644 --- a/X10D/src/Numerics/ByteExtensions.cs +++ b/X10D/src/Numerics/ByteExtensions.cs @@ -20,7 +20,7 @@ public static class ByteExtensions /// POPCNT /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static int PopCount(this byte value) { return ((uint)value).PopCount(); @@ -35,7 +35,7 @@ public static class ByteExtensions /// /// The rotated value. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static byte RotateLeft(this byte value, int count) { count = count.Mod(8); @@ -51,7 +51,7 @@ public static class ByteExtensions /// /// The rotated value. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static byte RotateRight(this byte value, int count) { count = count.Mod(8); @@ -67,7 +67,7 @@ public static class ByteExtensions /// is 0 or the result overflows. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static byte RoundUpToPowerOf2(this byte value) { return (byte)((uint)value).RoundUpToPowerOf2(); diff --git a/X10D/src/Numerics/Int16Extensions.cs b/X10D/src/Numerics/Int16Extensions.cs index 0e04682..b0278c9 100644 --- a/X10D/src/Numerics/Int16Extensions.cs +++ b/X10D/src/Numerics/Int16Extensions.cs @@ -19,7 +19,7 @@ public static class Int16Extensions /// POPCNT /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static int PopCount(this short value) { return ((uint)value).PopCount(); @@ -34,7 +34,7 @@ public static class Int16Extensions /// /// The rotated value. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static short RotateLeft(this short value, int count) { var unsigned = unchecked((ushort)value); @@ -50,7 +50,7 @@ public static class Int16Extensions /// /// The rotated value. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static short RotateRight(this short value, int count) { var unsigned = unchecked((ushort)value); @@ -66,7 +66,7 @@ public static class Int16Extensions /// is 0 or the result overflows. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static short RoundUpToPowerOf2(this short value) { return (short)((uint)value).RoundUpToPowerOf2(); diff --git a/X10D/src/Numerics/Int32Extensions.cs b/X10D/src/Numerics/Int32Extensions.cs index c64fd6c..2fb047e 100644 --- a/X10D/src/Numerics/Int32Extensions.cs +++ b/X10D/src/Numerics/Int32Extensions.cs @@ -19,7 +19,7 @@ public static class Int32Extensions /// POPCNT /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static int PopCount(this int value) { return ((uint)value).PopCount(); @@ -34,7 +34,7 @@ public static class Int32Extensions /// /// The rotated value. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static int RotateLeft(this int value, int count) { var unsigned = unchecked((uint)value); @@ -50,7 +50,7 @@ public static class Int32Extensions /// /// The rotated value. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static int RotateRight(this int value, int count) { var unsigned = unchecked((uint)value); @@ -66,7 +66,7 @@ public static class Int32Extensions /// is 0 or the result overflows. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static int RoundUpToPowerOf2(this int value) { return (int)((uint)value).RoundUpToPowerOf2(); diff --git a/X10D/src/Numerics/Int64Extensions.cs b/X10D/src/Numerics/Int64Extensions.cs index 7ead90b..598a73e 100644 --- a/X10D/src/Numerics/Int64Extensions.cs +++ b/X10D/src/Numerics/Int64Extensions.cs @@ -19,7 +19,7 @@ public static class Int64Extensions /// POPCNT /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static int PopCount(this long value) { return ((ulong)value).PopCount(); @@ -34,7 +34,7 @@ public static class Int64Extensions /// /// The rotated value. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static long RotateLeft(this long value, int count) { var unsigned = unchecked((ulong)value); @@ -50,7 +50,7 @@ public static class Int64Extensions /// /// The rotated value. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static long RotateRight(this long value, int count) { var unsigned = unchecked((ulong)value); @@ -66,7 +66,7 @@ public static class Int64Extensions /// is 0 or the result overflows. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static long RoundUpToPowerOf2(this long value) { return (long)((ulong)value).RoundUpToPowerOf2(); diff --git a/X10D/src/Numerics/SByteExtensions.cs b/X10D/src/Numerics/SByteExtensions.cs index e4f3f40..f498a54 100644 --- a/X10D/src/Numerics/SByteExtensions.cs +++ b/X10D/src/Numerics/SByteExtensions.cs @@ -20,7 +20,7 @@ public static class SByteExtensions /// POPCNT /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static int PopCount(this sbyte value) { return ((uint)value).PopCount(); @@ -35,7 +35,7 @@ public static class SByteExtensions /// /// The rotated value. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static sbyte RotateLeft(this sbyte value, int count) { var signed = unchecked((byte)value); @@ -51,7 +51,7 @@ public static class SByteExtensions /// /// The rotated value. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static sbyte RotateRight(this sbyte value, int count) { var signed = unchecked((byte)value); @@ -67,7 +67,7 @@ public static class SByteExtensions /// is 0 or the result overflows. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static sbyte RoundUpToPowerOf2(this sbyte value) { return (sbyte)((uint)value).RoundUpToPowerOf2(); diff --git a/X10D/src/Numerics/UInt16Extensions.cs b/X10D/src/Numerics/UInt16Extensions.cs index ad02430..cdd9723 100644 --- a/X10D/src/Numerics/UInt16Extensions.cs +++ b/X10D/src/Numerics/UInt16Extensions.cs @@ -20,7 +20,7 @@ public static class UInt16Extensions /// POPCNT /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static int PopCount(this ushort value) { return ((uint)value).PopCount(); @@ -35,7 +35,7 @@ public static class UInt16Extensions /// /// The rotated value. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static ushort RotateLeft(this ushort value, int count) { return (ushort)((ushort)(value << count) | (ushort)(value >> (16 - count))); @@ -50,7 +50,7 @@ public static class UInt16Extensions /// /// The rotated value. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static ushort RotateRight(this ushort value, int count) { return (ushort)((ushort)(value >> count) | (ushort)(value << (16 - count))); @@ -65,7 +65,7 @@ public static class UInt16Extensions /// is 0 or the result overflows. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static ushort RoundUpToPowerOf2(this ushort value) { return (ushort)((uint)value).RoundUpToPowerOf2(); diff --git a/X10D/src/Numerics/UInt32Extensions.cs b/X10D/src/Numerics/UInt32Extensions.cs index 319130a..869dc5f 100644 --- a/X10D/src/Numerics/UInt32Extensions.cs +++ b/X10D/src/Numerics/UInt32Extensions.cs @@ -21,7 +21,7 @@ public static class UInt32Extensions /// POPCNT /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static int PopCount(this uint value) { return BitOperations.PopCount(value); @@ -36,7 +36,7 @@ public static class UInt32Extensions /// /// The rotated value. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static uint RotateLeft(this uint value, int count) { return (value << count) | (value >> (32 - count)); @@ -51,7 +51,7 @@ public static class UInt32Extensions /// /// The rotated value. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static uint RotateRight(this uint value, int count) { return (value >> count) | (value << (32 - count)); @@ -66,7 +66,7 @@ public static class UInt32Extensions /// is 0 or the result overflows. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static uint RoundUpToPowerOf2(this uint value) { return BitOperations.RoundUpToPowerOf2(value); diff --git a/X10D/src/Numerics/UInt64Extensions.cs b/X10D/src/Numerics/UInt64Extensions.cs index b69b20f..42944c8 100644 --- a/X10D/src/Numerics/UInt64Extensions.cs +++ b/X10D/src/Numerics/UInt64Extensions.cs @@ -21,7 +21,7 @@ public static class UInt64Extensions /// POPCNT /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static int PopCount(this ulong value) { return BitOperations.PopCount(value); @@ -36,7 +36,7 @@ public static class UInt64Extensions /// /// The rotated value. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static ulong RotateLeft(this ulong value, int count) { return (value << count) | (value >> (64 - count)); @@ -51,7 +51,7 @@ public static class UInt64Extensions /// /// The rotated value. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static ulong RotateRight(this ulong value, int count) { return (value >> count) | (value << (64 - count)); @@ -66,7 +66,7 @@ public static class UInt64Extensions /// is 0 or the result overflows. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static ulong RoundUpToPowerOf2(this ulong value) { return BitOperations.RoundUpToPowerOf2(value); diff --git a/X10D/src/Numerics/Vector2Extensions.cs b/X10D/src/Numerics/Vector2Extensions.cs index 4bb52f2..2e67a40 100644 --- a/X10D/src/Numerics/Vector2Extensions.cs +++ b/X10D/src/Numerics/Vector2Extensions.cs @@ -35,7 +35,7 @@ public static class Vector2Extensions /// . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool IsOnLine(this Vector2 point, LineF line) { (float x1, float x2) = (line.Start.X, line.End.X); @@ -55,7 +55,7 @@ public static class Vector2Extensions /// ; otherwise . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool IsOnLine(this Vector2 point, PointF start, PointF end) { return point.IsOnLine(new LineF(start, end)); @@ -72,7 +72,7 @@ public static class Vector2Extensions /// ; otherwise . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool IsOnLine(this Vector2 point, Vector2 start, Vector2 end) { return point.IsOnLine(new LineF(start, end)); @@ -84,7 +84,7 @@ public static class Vector2Extensions /// The vector whose components to round. /// The rounded vector. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static Vector2 Round(this Vector2 vector) { return vector.Round(1.0f); @@ -97,7 +97,7 @@ public static class Vector2Extensions /// The nearest multiple to which the components should be rounded. /// The rounded vector. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static Vector2 Round(this Vector2 vector, float nearest) { float x = vector.X.Round(nearest); @@ -111,7 +111,7 @@ public static class Vector2Extensions /// The vector to convert. /// The resulting . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static PointF ToPointF(this Vector2 vector) { return new PointF(vector.X, vector.Y); @@ -123,7 +123,7 @@ public static class Vector2Extensions /// The vector to convert. /// The resulting . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static SizeF ToSizeF(this Vector2 vector) { return new SizeF(vector.X, vector.Y); @@ -139,7 +139,7 @@ public static class Vector2Extensions /// , and whose component is . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static Vector2 WithX(this Vector2 vector, float x) { return vector with {X = x}; @@ -155,7 +155,7 @@ public static class Vector2Extensions /// , and whose component is . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static Vector2 WithY(this Vector2 vector, float y) { return vector with {Y = y}; diff --git a/X10D/src/Numerics/Vector3Extensions.cs b/X10D/src/Numerics/Vector3Extensions.cs index 29b5b9e..3bc6ce7 100644 --- a/X10D/src/Numerics/Vector3Extensions.cs +++ b/X10D/src/Numerics/Vector3Extensions.cs @@ -31,7 +31,7 @@ public static class Vector3Extensions /// The vector whose components to round. /// The rounded vector. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static Vector3 Round(this Vector3 vector) { return vector.Round(1.0f); @@ -44,7 +44,7 @@ public static class Vector3Extensions /// The nearest multiple to which the components should be rounded. /// The rounded vector. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static Vector3 Round(this Vector3 vector, float nearest) { float x = vector.X.Round(nearest); @@ -63,7 +63,7 @@ public static class Vector3Extensions /// the same as that of , and whose component is . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static Vector3 WithX(this Vector3 vector, float x) { return vector with {X = x}; @@ -79,7 +79,7 @@ public static class Vector3Extensions /// the same as that of , and whose component is . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static Vector3 WithY(this Vector3 vector, float y) { return vector with {Y = y}; @@ -95,7 +95,7 @@ public static class Vector3Extensions /// the same as that of , and whose component is . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static Vector3 WithZ(this Vector3 vector, float z) { return vector with {Z = z}; diff --git a/X10D/src/Numerics/Vector4Extensions.cs b/X10D/src/Numerics/Vector4Extensions.cs index 4c6d9df..ab79c5f 100644 --- a/X10D/src/Numerics/Vector4Extensions.cs +++ b/X10D/src/Numerics/Vector4Extensions.cs @@ -33,7 +33,7 @@ public static class Vector4Extensions /// The vector whose components to round. /// The rounded vector. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static Vector4 Round(this Vector4 vector) { return vector.Round(1.0f); @@ -46,7 +46,7 @@ public static class Vector4Extensions /// The nearest multiple to which the components should be rounded. /// The rounded vector. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static Vector4 Round(this Vector4 vector, float nearest) { float x = vector.X.Round(nearest); @@ -68,7 +68,7 @@ public static class Vector4Extensions /// component is . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static Vector4 WithX(this Vector4 vector, float x) { return vector with {X = x}; @@ -86,7 +86,7 @@ public static class Vector4Extensions /// component is . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static Vector4 WithY(this Vector4 vector, float y) { return vector with {Y = y}; @@ -104,7 +104,7 @@ public static class Vector4Extensions /// component is . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static Vector4 WithZ(this Vector4 vector, float z) { return vector with {Z = z}; @@ -122,7 +122,7 @@ public static class Vector4Extensions /// component is . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static Vector4 WithW(this Vector4 vector, float w) { return vector with {W = w}; diff --git a/X10D/src/Reflection/MemberInfoExtensions.cs b/X10D/src/Reflection/MemberInfoExtensions.cs index 166207e..8e9ed92 100644 --- a/X10D/src/Reflection/MemberInfoExtensions.cs +++ b/X10D/src/Reflection/MemberInfoExtensions.cs @@ -22,7 +22,7 @@ public static class MemberInfoExtensions /// /// is . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool HasCustomAttribute(this MemberInfo member) where T : Attribute { @@ -45,7 +45,7 @@ public static class MemberInfoExtensions /// /// is . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool HasCustomAttribute(this MemberInfo member, Type attribute) { if (member is null) diff --git a/X10D/src/Reflection/TypeExtensions.cs b/X10D/src/Reflection/TypeExtensions.cs index a36a2a5..b1e34fb 100644 --- a/X10D/src/Reflection/TypeExtensions.cs +++ b/X10D/src/Reflection/TypeExtensions.cs @@ -18,7 +18,7 @@ public static class TypeExtensions /// if the current exists on the type; otherwise, . /// is . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool Implements(this Type value) { if (value is null) @@ -41,7 +41,7 @@ public static class TypeExtensions /// is . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool Implements(this Type value, Type interfaceType) { if (value is null) @@ -77,7 +77,7 @@ public static class TypeExtensions /// is . /// is not a class. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool Inherits(this Type value) where T : class { @@ -109,7 +109,7 @@ public static class TypeExtensions /// is not a class. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool Inherits(this Type value, Type type) { if (value is null) diff --git a/X10D/src/Text/CharExtensions.cs b/X10D/src/Text/CharExtensions.cs index 5d27d4b..44efb04 100644 --- a/X10D/src/Text/CharExtensions.cs +++ b/X10D/src/Text/CharExtensions.cs @@ -15,7 +15,7 @@ public static class CharExtensions /// The character to check. /// if this character is an emoji; otherwise, . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool IsEmoji(this char value) { #if NET7_0_OR_GREATER @@ -36,7 +36,7 @@ public static class CharExtensions /// A composed of repeated times. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static string Repeat(this char value, int count) { return count switch diff --git a/X10D/src/Text/Extensions.cs b/X10D/src/Text/Extensions.cs index 9d9a4b6..b6c7ff5 100644 --- a/X10D/src/Text/Extensions.cs +++ b/X10D/src/Text/Extensions.cs @@ -18,7 +18,7 @@ public static class Extensions /// The type of the value to convert. /// A JSON string representing the object. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static string ToJson(this T value, JsonSerializerOptions? options = null) { return JsonSerializer.Serialize(value, options); diff --git a/X10D/src/Text/RuneExtensions.cs b/X10D/src/Text/RuneExtensions.cs index adfaeec..47349b1 100644 --- a/X10D/src/Text/RuneExtensions.cs +++ b/X10D/src/Text/RuneExtensions.cs @@ -19,7 +19,7 @@ public static class RuneExtensions /// The rune to check. /// if this rune is an emoji; otherwise, . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool IsEmoji(this Rune value) { return value.ToString().IsEmoji(); @@ -34,7 +34,7 @@ public static class RuneExtensions /// A composed of repeated times. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static string Repeat(this Rune value, int count) { switch (count) diff --git a/X10D/src/Text/StringExtensions.cs b/X10D/src/Text/StringExtensions.cs index 6b33f9d..6aef82b 100644 --- a/X10D/src/Text/StringExtensions.cs +++ b/X10D/src/Text/StringExtensions.cs @@ -24,7 +24,7 @@ public static class StringExtensions /// . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] [return: NotNullIfNotNull("value")] public static string? AsNullIfEmpty(this string? value) { @@ -41,7 +41,7 @@ public static class StringExtensions /// whitespace; otherwise, . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] [return: NotNullIfNotNull("value")] public static string? AsNullIfWhiteSpace(this string? value) { @@ -55,7 +55,7 @@ public static class StringExtensions /// The plain text string representation of . /// is . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static string Base64Decode(this string value) { if (value is null) @@ -73,7 +73,7 @@ public static class StringExtensions /// The string representation, in base 64, of . /// is . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static string Base64Encode(this string value) { if (value is null) @@ -102,7 +102,7 @@ public static class StringExtensions /// is . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static string ChangeEncoding(this string value, Encoding sourceEncoding, Encoding destinationEncoding) { if (value is null) @@ -535,7 +535,7 @@ public static class StringExtensions /// (http://geekswithblogs.net/sdorman/Default.aspx). /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static T EnumParse(this string value) where T : struct, Enum { @@ -554,7 +554,7 @@ public static class StringExtensions /// (http://geekswithblogs.net/sdorman/Default.aspx). /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static T EnumParse(this string value, bool ignoreCase) where T : struct, Enum { @@ -595,7 +595,7 @@ public static class StringExtensions /// The string to convert. /// Returns a []. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static byte[] GetBytes(this string value) { return value.GetBytes(Encoding.UTF8); @@ -612,7 +612,7 @@ public static class StringExtensions /// . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static byte[] GetBytes(this string value, Encoding encoding) { if (value is null) @@ -634,7 +634,7 @@ public static class StringExtensions /// The input string. /// if this string is an emoji; otherwise, . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool IsEmoji(this string value) { if (value is null) @@ -654,7 +654,7 @@ public static class StringExtensions /// /// is . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool IsEmpty(this string value) { if (value is null) @@ -674,7 +674,7 @@ public static class StringExtensions /// /// is . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool IsLower(this string value) { if (value is null) @@ -710,7 +710,7 @@ public static class StringExtensions /// . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool IsNullOrEmpty([NotNullWhen(false)] this string? value) { return string.IsNullOrEmpty(value); @@ -726,7 +726,7 @@ public static class StringExtensions /// whitespace; otherwise, . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool IsNullOrWhiteSpace([NotNullWhen(false)] this string? value) { return string.IsNullOrWhiteSpace(value); @@ -743,7 +743,7 @@ public static class StringExtensions /// /// is . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool IsPalindrome(this string value) { if (value is null) @@ -791,7 +791,7 @@ public static class StringExtensions /// if all alpha characters in this string are uppercase; otherwise, . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool IsUpper(this string value) { if (value is null) @@ -828,7 +828,7 @@ public static class StringExtensions /// /// is . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool IsWhiteSpace(this string value) { if (value is null) @@ -860,7 +860,7 @@ public static class StringExtensions /// A string containing repeated times. /// is . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static string Repeat(this string value, int count) { if (value is null) @@ -937,7 +937,7 @@ public static class StringExtensions /// is . /// is less than 0. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static string Randomize(this string source, int length, Random? random = null) { if (source is null) @@ -975,7 +975,7 @@ public static class StringExtensions /// The string to reverse. /// A whose characters are that of in reverse order. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static string Reverse(this string value) { if (value is null) @@ -1009,7 +1009,7 @@ public static class StringExtensions /// A new containing the characters in , rearranged. /// is . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static string Shuffled(this string value, Random? random = null) { if (value is null) @@ -1035,7 +1035,7 @@ public static class StringExtensions /// /// is . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static IEnumerable Split(this string value, int chunkSize) { if (value is null) @@ -1135,7 +1135,7 @@ public static class StringExtensions /// . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] [return: NotNullIfNotNull("alternative")] public static string? WithEmptyAlternative(this string? value, string? alternative) { @@ -1153,7 +1153,7 @@ public static class StringExtensions /// whitespace; otherwise, . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] [return: NotNullIfNotNull("alternative")] public static string? WithWhiteSpaceAlternative(this string? value, string? alternative) { diff --git a/X10D/src/Time/ByteExtensions.cs b/X10D/src/Time/ByteExtensions.cs index 8d480d1..700cd17 100644 --- a/X10D/src/Time/ByteExtensions.cs +++ b/X10D/src/Time/ByteExtensions.cs @@ -18,7 +18,7 @@ public static class ByteExtensions /// /// is 0. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool IsLeapYear(this byte value) { if (value == 0) @@ -44,7 +44,7 @@ public static class ByteExtensions /// is greater than 253,402,300,799,999. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static DateTimeOffset FromUnixTimeMilliseconds(this byte value) { return DateTimeOffset.FromUnixTimeMilliseconds(value); @@ -65,7 +65,7 @@ public static class ByteExtensions /// is greater than 253,402,300,799. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static DateTimeOffset FromUnixTimeSeconds(this byte value) { return DateTimeOffset.FromUnixTimeSeconds(value); @@ -77,7 +77,7 @@ public static class ByteExtensions /// The duration, in ticks. /// A whose will equal . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Ticks(this byte value) { return TimeSpan.FromTicks(value); @@ -91,7 +91,7 @@ public static class ByteExtensions /// A whose will equal . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Milliseconds(this byte value) { return TimeSpan.FromMilliseconds(value); @@ -105,7 +105,7 @@ public static class ByteExtensions /// A whose will equal . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Seconds(this byte value) { return TimeSpan.FromSeconds(value); @@ -119,7 +119,7 @@ public static class ByteExtensions /// A whose will equal . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Minutes(this byte value) { return TimeSpan.FromMinutes(value); @@ -133,7 +133,7 @@ public static class ByteExtensions /// A whose will equal . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Hours(this byte value) { return TimeSpan.FromHours(value); @@ -145,7 +145,7 @@ public static class ByteExtensions /// The duration, in days. /// A whose will equal . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Days(this byte value) { return TimeSpan.FromDays(value); @@ -159,7 +159,7 @@ public static class ByteExtensions /// A whose will equal × 7. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Weeks(this byte value) { return TimeSpan.FromDays(value * 7); diff --git a/X10D/src/Time/CharSpanExtensions.cs b/X10D/src/Time/CharSpanExtensions.cs index 3a41f06..64072c9 100644 --- a/X10D/src/Time/CharSpanExtensions.cs +++ b/X10D/src/Time/CharSpanExtensions.cs @@ -58,7 +58,7 @@ public static class CharSpanExtensions /// /// A new instance of . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan ToTimeSpan(this ReadOnlySpan input) { return TimeSpanParser.TryParse(input, out TimeSpan result) ? result : default; diff --git a/X10D/src/Time/DateOnlyExtensions.cs b/X10D/src/Time/DateOnlyExtensions.cs index f2b4e81..fd59001 100644 --- a/X10D/src/Time/DateOnlyExtensions.cs +++ b/X10D/src/Time/DateOnlyExtensions.cs @@ -16,7 +16,7 @@ public static class DateOnlyExtensions /// The date from which to calculate. /// The rounded-down integer number of years since as of today. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] [ExcludeFromCodeCoverage] public static int Age(this DateOnly value) { @@ -33,7 +33,7 @@ public static class DateOnlyExtensions /// . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static int Age(this DateOnly value, DateOnly referenceDate) { return value.ToDateTime(default).Age(referenceDate.ToDateTime(default)); @@ -60,7 +60,7 @@ public static class DateOnlyExtensions /// The day of the week. /// A representing the first occurence of . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static DateOnly First(this DateOnly value, DayOfWeek dayOfWeek) { DateOnly first = value.FirstDayOfMonth(); @@ -79,7 +79,7 @@ public static class DateOnlyExtensions /// The current date. /// A representing the first day of the current month. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static DateOnly FirstDayOfMonth(this DateOnly value) { return value.AddDays(1 - value.Day); @@ -113,7 +113,7 @@ public static class DateOnlyExtensions /// . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool IsLeapYear(this DateOnly value) { return DateTime.IsLeapYear(value.Year); @@ -126,7 +126,7 @@ public static class DateOnlyExtensions /// The day of the week. /// A representing the final occurence of . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static DateOnly Last(this DateOnly value, DayOfWeek dayOfWeek) { DateOnly last = value.LastDayOfMonth(); @@ -144,7 +144,7 @@ public static class DateOnlyExtensions /// The current date. /// A representing the last day of the current month. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static DateOnly LastDayOfMonth(this DateOnly value) { int daysInMonth = DateTime.DaysInMonth(value.Year, value.Month); @@ -158,7 +158,7 @@ public static class DateOnlyExtensions /// The day of the week. /// A representing the next occurence of . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static DateOnly Next(this DateOnly value, DayOfWeek dayOfWeek) { int offsetDays = dayOfWeek - value.DayOfWeek; @@ -178,7 +178,7 @@ public static class DateOnlyExtensions /// A reference time to use with the current date. /// The number of milliseconds that have elapsed since 1970-01-01T00:00:00.000Z. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static long ToUnixTimeMilliseconds(this DateOnly value, TimeOnly time) { return value.ToDateTime(time).ToUnixTimeMilliseconds(); @@ -191,7 +191,7 @@ public static class DateOnlyExtensions /// A reference time to use with the current date. /// The number of seconds that have elapsed since 1970-01-01T00:00:00.000Z. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static long ToUnixTimeSeconds(this DateOnly value, TimeOnly time) { return value.ToDateTime(time).ToUnixTimeSeconds(); diff --git a/X10D/src/Time/DateTimeExtensions.cs b/X10D/src/Time/DateTimeExtensions.cs index 6750b15..d82a796 100644 --- a/X10D/src/Time/DateTimeExtensions.cs +++ b/X10D/src/Time/DateTimeExtensions.cs @@ -13,7 +13,7 @@ public static class DateTimeExtensions { /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] [ExcludeFromCodeCoverage] public static int Age(this DateTime value) { @@ -22,7 +22,7 @@ public static class DateTimeExtensions /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static int Age(this DateTime value, DateTime referenceDate) { return ((DateTimeOffset)value).Age(referenceDate); @@ -31,7 +31,7 @@ public static class DateTimeExtensions /// /// A representing the first occurence of . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static DateTime First(this DateTime value, DayOfWeek dayOfWeek) { return ((DateTimeOffset)value).First(dayOfWeek).DateTime; @@ -40,7 +40,7 @@ public static class DateTimeExtensions /// /// A representing the first day of the current month. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static DateTime FirstDayOfMonth(this DateTime value) { return ((DateTimeOffset)value).FirstDayOfMonth().DateTime; @@ -81,7 +81,7 @@ public static class DateTimeExtensions /// . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool IsLeapYear(this DateTime value) { return DateTime.IsLeapYear(value.Year); @@ -90,7 +90,7 @@ public static class DateTimeExtensions /// /// A representing the final occurence of . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static DateTime Last(this DateTime value, DayOfWeek dayOfWeek) { return ((DateTimeOffset)value).Last(dayOfWeek).DateTime; @@ -99,7 +99,7 @@ public static class DateTimeExtensions /// /// A representing the last day of the current month. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static DateTime LastDayOfMonth(this DateTime value) { return ((DateTimeOffset)value).LastDayOfMonth().DateTime; @@ -108,7 +108,7 @@ public static class DateTimeExtensions /// /// A representing the next occurence of . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static DateTime Next(this DateTime value, DayOfWeek dayOfWeek) { return ((DateTimeOffset)value).Next(dayOfWeek).DateTime; @@ -120,7 +120,7 @@ public static class DateTimeExtensions /// The current date. /// The number of milliseconds that have elapsed since 1970-01-01T00:00:00.000Z. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static long ToUnixTimeMilliseconds(this DateTime value) { return ((DateTimeOffset)value).ToUnixTimeMilliseconds(); @@ -132,7 +132,7 @@ public static class DateTimeExtensions /// The current date. /// The number of seconds that have elapsed since 1970-01-01T00:00:00.000Z. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static long ToUnixTimeSeconds(this DateTime value) { return ((DateTimeOffset)value).ToUnixTimeSeconds(); diff --git a/X10D/src/Time/DateTimeOffsetExtensions.cs b/X10D/src/Time/DateTimeOffsetExtensions.cs index ca606f1..1efe89b 100644 --- a/X10D/src/Time/DateTimeOffsetExtensions.cs +++ b/X10D/src/Time/DateTimeOffsetExtensions.cs @@ -16,7 +16,7 @@ public static class DateTimeOffsetExtensions /// The date from which to calculate. /// The rounded-down integer number of years since as of today. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] [ExcludeFromCodeCoverage] public static int Age(this DateTimeOffset value) { @@ -33,7 +33,7 @@ public static class DateTimeOffsetExtensions /// . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static int Age(this DateTimeOffset value, DateTimeOffset referenceDate) { return (int)(((referenceDate.Date - TimeSpan.FromDays(1) - value.Date).TotalDays + 1) / 365.2425); @@ -46,7 +46,7 @@ public static class DateTimeOffsetExtensions /// The day of the week. /// A representing the first occurence of . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static DateTimeOffset First(this DateTimeOffset value, DayOfWeek dayOfWeek) { var first = value.FirstDayOfMonth(); @@ -65,7 +65,7 @@ public static class DateTimeOffsetExtensions /// The current date. /// A representing the first day of the current month. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static DateTimeOffset FirstDayOfMonth(this DateTimeOffset value) { return value.AddDays(1 - value.Day); @@ -99,7 +99,7 @@ public static class DateTimeOffsetExtensions /// . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool IsLeapYear(this DateTimeOffset value) { return DateTime.IsLeapYear(value.Year); @@ -112,7 +112,7 @@ public static class DateTimeOffsetExtensions /// The day of the week. /// A representing the final occurence of . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static DateTimeOffset Last(this DateTimeOffset value, DayOfWeek dayOfWeek) { var last = value.LastDayOfMonth(); @@ -130,7 +130,7 @@ public static class DateTimeOffsetExtensions /// The current date. /// A representing the last day of the current month. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static DateTimeOffset LastDayOfMonth(this DateTimeOffset value) { int daysInMonth = DateTime.DaysInMonth(value.Year, value.Month); @@ -144,7 +144,7 @@ public static class DateTimeOffsetExtensions /// The day of the week. /// A representing the next occurence of . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static DateTimeOffset Next(this DateTimeOffset value, DayOfWeek dayOfWeek) { int offsetDays = dayOfWeek - value.DayOfWeek; diff --git a/X10D/src/Time/DecimalExtensions.cs b/X10D/src/Time/DecimalExtensions.cs index 41cf384..0fc1f0f 100644 --- a/X10D/src/Time/DecimalExtensions.cs +++ b/X10D/src/Time/DecimalExtensions.cs @@ -17,7 +17,7 @@ public static class DecimalExtensions /// A whose will equal . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Milliseconds(this decimal value) { return TimeSpan.FromMilliseconds((double)value); @@ -31,7 +31,7 @@ public static class DecimalExtensions /// A whose will equal . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Seconds(this decimal value) { return TimeSpan.FromSeconds((double)value); @@ -45,7 +45,7 @@ public static class DecimalExtensions /// A whose will equal . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Minutes(this decimal value) { return TimeSpan.FromMinutes((double)value); @@ -59,7 +59,7 @@ public static class DecimalExtensions /// A whose will equal . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Hours(this decimal value) { return TimeSpan.FromHours((double)value); @@ -71,7 +71,7 @@ public static class DecimalExtensions /// The duration, in days. /// A whose will equal . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Days(this decimal value) { return TimeSpan.FromDays((double)value); @@ -85,7 +85,7 @@ public static class DecimalExtensions /// A whose will equal × 7. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Weeks(this decimal value) { return TimeSpan.FromDays((double)value * 7); diff --git a/X10D/src/Time/DoubleExtensions.cs b/X10D/src/Time/DoubleExtensions.cs index f4054d9..04878df 100644 --- a/X10D/src/Time/DoubleExtensions.cs +++ b/X10D/src/Time/DoubleExtensions.cs @@ -17,7 +17,7 @@ public static class DoubleExtensions /// A whose will equal . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Milliseconds(this double value) { return TimeSpan.FromMilliseconds(value); @@ -31,7 +31,7 @@ public static class DoubleExtensions /// A whose will equal . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Seconds(this double value) { return TimeSpan.FromSeconds(value); @@ -45,7 +45,7 @@ public static class DoubleExtensions /// A whose will equal . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Minutes(this double value) { return TimeSpan.FromMinutes(value); @@ -59,7 +59,7 @@ public static class DoubleExtensions /// A whose will equal . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Hours(this double value) { return TimeSpan.FromHours(value); @@ -71,7 +71,7 @@ public static class DoubleExtensions /// The duration, in days. /// A whose will equal . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Days(this double value) { return TimeSpan.FromDays(value); @@ -85,7 +85,7 @@ public static class DoubleExtensions /// A whose will equal × 7. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Weeks(this double value) { return TimeSpan.FromDays(value * 7); diff --git a/X10D/src/Time/HalfExtensions.cs b/X10D/src/Time/HalfExtensions.cs index fa914b5..d6b52ed 100644 --- a/X10D/src/Time/HalfExtensions.cs +++ b/X10D/src/Time/HalfExtensions.cs @@ -17,7 +17,7 @@ public static class HalfExtensions /// A whose will equal . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Milliseconds(this Half value) { return TimeSpan.FromMilliseconds((float)value); @@ -31,7 +31,7 @@ public static class HalfExtensions /// A whose will equal . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Seconds(this Half value) { return TimeSpan.FromSeconds((float)value); @@ -45,7 +45,7 @@ public static class HalfExtensions /// A whose will equal . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Minutes(this Half value) { return TimeSpan.FromMinutes((float)value); @@ -59,7 +59,7 @@ public static class HalfExtensions /// A whose will equal . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Hours(this Half value) { return TimeSpan.FromHours((float)value); @@ -71,7 +71,7 @@ public static class HalfExtensions /// The duration, in days. /// A whose will equal . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Days(this Half value) { return TimeSpan.FromDays((float)value); @@ -85,7 +85,7 @@ public static class HalfExtensions /// A whose will equal × 7. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Weeks(this Half value) { return TimeSpan.FromDays((float)value * 7); diff --git a/X10D/src/Time/Int16Extensions.cs b/X10D/src/Time/Int16Extensions.cs index b0b17df..fc0cfdb 100644 --- a/X10D/src/Time/Int16Extensions.cs +++ b/X10D/src/Time/Int16Extensions.cs @@ -19,7 +19,7 @@ public static class Int16Extensions /// /// is 0. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool IsLeapYear(this short value) { if (value == 0) @@ -50,7 +50,7 @@ public static class Int16Extensions /// is greater than 253,402,300,799,999. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static DateTimeOffset FromUnixTimeMilliseconds(this short value) { return DateTimeOffset.FromUnixTimeMilliseconds(value); @@ -71,7 +71,7 @@ public static class Int16Extensions /// is greater than 253,402,300,799. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static DateTimeOffset FromUnixTimeSeconds(this short value) { return DateTimeOffset.FromUnixTimeSeconds(value); @@ -83,7 +83,7 @@ public static class Int16Extensions /// The duration, in ticks. /// A whose will equal . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Ticks(this short value) { return TimeSpan.FromTicks(value); @@ -97,7 +97,7 @@ public static class Int16Extensions /// A whose will equal . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Milliseconds(this short value) { return TimeSpan.FromMilliseconds(value); @@ -111,7 +111,7 @@ public static class Int16Extensions /// A whose will equal . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Seconds(this short value) { return TimeSpan.FromSeconds(value); @@ -125,7 +125,7 @@ public static class Int16Extensions /// A whose will equal . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Minutes(this short value) { return TimeSpan.FromMinutes(value); @@ -139,7 +139,7 @@ public static class Int16Extensions /// A whose will equal . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Hours(this short value) { return TimeSpan.FromHours(value); @@ -151,7 +151,7 @@ public static class Int16Extensions /// The duration, in days. /// A whose will equal . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Days(this short value) { return TimeSpan.FromDays(value); @@ -165,7 +165,7 @@ public static class Int16Extensions /// A whose will equal × 7. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Weeks(this short value) { return TimeSpan.FromDays(value * 7); diff --git a/X10D/src/Time/Int32Extensions.cs b/X10D/src/Time/Int32Extensions.cs index 2fc108a..52bd6f3 100644 --- a/X10D/src/Time/Int32Extensions.cs +++ b/X10D/src/Time/Int32Extensions.cs @@ -19,7 +19,7 @@ public static class Int32Extensions /// /// is 0. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool IsLeapYear(this int value) { if (value == 0) @@ -50,7 +50,7 @@ public static class Int32Extensions /// is greater than 253,402,300,799,999. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static DateTimeOffset FromUnixTimeMilliseconds(this int value) { return DateTimeOffset.FromUnixTimeMilliseconds(value); @@ -71,7 +71,7 @@ public static class Int32Extensions /// is greater than 253,402,300,799. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static DateTimeOffset FromUnixTimeSeconds(this int value) { return DateTimeOffset.FromUnixTimeSeconds(value); @@ -83,7 +83,7 @@ public static class Int32Extensions /// The duration, in ticks. /// A whose will equal . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Ticks(this int value) { return TimeSpan.FromTicks(value); @@ -97,7 +97,7 @@ public static class Int32Extensions /// A whose will equal . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Milliseconds(this int value) { return TimeSpan.FromMilliseconds(value); @@ -111,7 +111,7 @@ public static class Int32Extensions /// A whose will equal . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Seconds(this int value) { return TimeSpan.FromSeconds(value); @@ -125,7 +125,7 @@ public static class Int32Extensions /// A whose will equal . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Minutes(this int value) { return TimeSpan.FromMinutes(value); @@ -139,7 +139,7 @@ public static class Int32Extensions /// A whose will equal . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Hours(this int value) { return TimeSpan.FromHours(value); @@ -151,7 +151,7 @@ public static class Int32Extensions /// The duration, in days. /// A whose will equal . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Days(this int value) { return TimeSpan.FromDays(value); @@ -165,7 +165,7 @@ public static class Int32Extensions /// A whose will equal × 7. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Weeks(this int value) { return TimeSpan.FromDays(value * 7); diff --git a/X10D/src/Time/Int64Extensions.cs b/X10D/src/Time/Int64Extensions.cs index 24ff185..84a999e 100644 --- a/X10D/src/Time/Int64Extensions.cs +++ b/X10D/src/Time/Int64Extensions.cs @@ -19,7 +19,7 @@ public static class Int64Extensions /// /// is 0. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool IsLeapYear(this long value) { if (value == 0) @@ -50,7 +50,7 @@ public static class Int64Extensions /// is greater than 253,402,300,799,999. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static DateTimeOffset FromUnixTimeMilliseconds(this long value) { return DateTimeOffset.FromUnixTimeMilliseconds(value); @@ -71,7 +71,7 @@ public static class Int64Extensions /// is greater than 253,402,300,799. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static DateTimeOffset FromUnixTimeSeconds(this long value) { return DateTimeOffset.FromUnixTimeSeconds(value); @@ -83,7 +83,7 @@ public static class Int64Extensions /// The duration, in ticks. /// A whose will equal . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Ticks(this long value) { return TimeSpan.FromTicks(value); @@ -97,7 +97,7 @@ public static class Int64Extensions /// A whose will equal . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Milliseconds(this long value) { return TimeSpan.FromMilliseconds(value); @@ -111,7 +111,7 @@ public static class Int64Extensions /// A whose will equal . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Seconds(this long value) { return TimeSpan.FromSeconds(value); @@ -125,7 +125,7 @@ public static class Int64Extensions /// A whose will equal . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Minutes(this long value) { return TimeSpan.FromMinutes(value); @@ -139,7 +139,7 @@ public static class Int64Extensions /// A whose will equal . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Hours(this long value) { return TimeSpan.FromHours(value); @@ -151,7 +151,7 @@ public static class Int64Extensions /// The duration, in days. /// A whose will equal . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Days(this long value) { return TimeSpan.FromDays(value); @@ -165,7 +165,7 @@ public static class Int64Extensions /// A whose will equal × 7. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Weeks(this long value) { return TimeSpan.FromDays(value * 7); diff --git a/X10D/src/Time/SByteExtensions.cs b/X10D/src/Time/SByteExtensions.cs index f66385b..babd8d3 100644 --- a/X10D/src/Time/SByteExtensions.cs +++ b/X10D/src/Time/SByteExtensions.cs @@ -20,7 +20,7 @@ public static class SByteExtensions /// /// is 0. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool IsLeapYear(this sbyte value) { if (value == 0) @@ -51,7 +51,7 @@ public static class SByteExtensions /// is greater than 253,402,300,799,999. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static DateTimeOffset FromUnixTimeMilliseconds(this sbyte value) { return DateTimeOffset.FromUnixTimeMilliseconds(value); @@ -72,7 +72,7 @@ public static class SByteExtensions /// is greater than 253,402,300,799. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static DateTimeOffset FromUnixTimeSeconds(this sbyte value) { return DateTimeOffset.FromUnixTimeSeconds(value); @@ -84,7 +84,7 @@ public static class SByteExtensions /// The duration, in ticks. /// A whose will equal . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Ticks(this sbyte value) { return TimeSpan.FromTicks(value); @@ -98,7 +98,7 @@ public static class SByteExtensions /// A whose will equal . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Milliseconds(this sbyte value) { return TimeSpan.FromMilliseconds(value); @@ -112,7 +112,7 @@ public static class SByteExtensions /// A whose will equal . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Seconds(this sbyte value) { return TimeSpan.FromSeconds(value); @@ -126,7 +126,7 @@ public static class SByteExtensions /// A whose will equal . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Minutes(this sbyte value) { return TimeSpan.FromMinutes(value); @@ -140,7 +140,7 @@ public static class SByteExtensions /// A whose will equal . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Hours(this sbyte value) { return TimeSpan.FromHours(value); @@ -152,7 +152,7 @@ public static class SByteExtensions /// The duration, in days. /// A whose will equal . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Days(this sbyte value) { return TimeSpan.FromDays(value); @@ -166,7 +166,7 @@ public static class SByteExtensions /// A whose will equal × 7. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Weeks(this sbyte value) { return TimeSpan.FromDays(value * 7); diff --git a/X10D/src/Time/SingleExtensions.cs b/X10D/src/Time/SingleExtensions.cs index 2403b4e..ccab055 100644 --- a/X10D/src/Time/SingleExtensions.cs +++ b/X10D/src/Time/SingleExtensions.cs @@ -17,7 +17,7 @@ public static class SingleExtensions /// A whose will equal . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Milliseconds(this float value) { return TimeSpan.FromMilliseconds(value); @@ -31,7 +31,7 @@ public static class SingleExtensions /// A whose will equal . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Seconds(this float value) { return TimeSpan.FromSeconds(value); @@ -45,7 +45,7 @@ public static class SingleExtensions /// A whose will equal . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Minutes(this float value) { return TimeSpan.FromMinutes(value); @@ -59,7 +59,7 @@ public static class SingleExtensions /// A whose will equal . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Hours(this float value) { return TimeSpan.FromHours(value); @@ -71,7 +71,7 @@ public static class SingleExtensions /// The duration, in days. /// A whose will equal . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Days(this float value) { return TimeSpan.FromDays(value); @@ -85,7 +85,7 @@ public static class SingleExtensions /// A whose will equal × 7. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Weeks(this float value) { return TimeSpan.FromDays(value * 7); diff --git a/X10D/src/Time/StringExtensions.cs b/X10D/src/Time/StringExtensions.cs index 668f26d..4960877 100644 --- a/X10D/src/Time/StringExtensions.cs +++ b/X10D/src/Time/StringExtensions.cs @@ -58,7 +58,7 @@ public static class StringExtensions /// A new instance of . /// is . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan ToTimeSpan(this string input) { if (input is null) diff --git a/X10D/src/Time/TimeSpanExtensions.cs b/X10D/src/Time/TimeSpanExtensions.cs index f39b39b..c6e5e7b 100644 --- a/X10D/src/Time/TimeSpanExtensions.cs +++ b/X10D/src/Time/TimeSpanExtensions.cs @@ -17,7 +17,7 @@ public static class TimeSpanExtensions /// A that is a duration of in the past relative to the current time. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static DateTime Ago(this TimeSpan value) { return DateTime.Now.Subtract(value); @@ -31,7 +31,7 @@ public static class TimeSpanExtensions /// A that is a duration of in the future relative to the current time. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static DateTime FromNow(this TimeSpan value) { return DateTime.Now.Add(value); diff --git a/X10D/src/Time/UInt16Extensions.cs b/X10D/src/Time/UInt16Extensions.cs index 967d21d..16180ed 100644 --- a/X10D/src/Time/UInt16Extensions.cs +++ b/X10D/src/Time/UInt16Extensions.cs @@ -25,7 +25,7 @@ public static class UInt16Extensions /// is greater than 253,402,300,799,999. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static DateTimeOffset FromUnixTimeMilliseconds(this ushort value) { return DateTimeOffset.FromUnixTimeMilliseconds(value); @@ -46,7 +46,7 @@ public static class UInt16Extensions /// is greater than 253,402,300,799. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static DateTimeOffset FromUnixTimeSeconds(this ushort value) { return DateTimeOffset.FromUnixTimeSeconds(value); @@ -61,7 +61,7 @@ public static class UInt16Extensions /// /// is 0. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool IsLeapYear(this ushort value) { if (value == 0) @@ -78,7 +78,7 @@ public static class UInt16Extensions /// The duration, in ticks. /// A whose will equal . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Ticks(this ushort value) { return TimeSpan.FromTicks(value); @@ -92,7 +92,7 @@ public static class UInt16Extensions /// A whose will equal . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Milliseconds(this ushort value) { return TimeSpan.FromMilliseconds(value); @@ -106,7 +106,7 @@ public static class UInt16Extensions /// A whose will equal . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Seconds(this ushort value) { return TimeSpan.FromSeconds(value); @@ -120,7 +120,7 @@ public static class UInt16Extensions /// A whose will equal . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Minutes(this ushort value) { return TimeSpan.FromMinutes(value); @@ -134,7 +134,7 @@ public static class UInt16Extensions /// A whose will equal . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Hours(this ushort value) { return TimeSpan.FromHours(value); @@ -146,7 +146,7 @@ public static class UInt16Extensions /// The duration, in days. /// A whose will equal . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Days(this ushort value) { return TimeSpan.FromDays(value); @@ -160,7 +160,7 @@ public static class UInt16Extensions /// A whose will equal × 7. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Weeks(this ushort value) { return TimeSpan.FromDays(value * 7); diff --git a/X10D/src/Time/UInt32Extensions.cs b/X10D/src/Time/UInt32Extensions.cs index ac21a16..05d890b 100644 --- a/X10D/src/Time/UInt32Extensions.cs +++ b/X10D/src/Time/UInt32Extensions.cs @@ -25,7 +25,7 @@ public static class UInt32Extensions /// is greater than 253,402,300,799,999. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static DateTimeOffset FromUnixTimeMilliseconds(this uint value) { return DateTimeOffset.FromUnixTimeMilliseconds(value); @@ -46,7 +46,7 @@ public static class UInt32Extensions /// is greater than 253,402,300,799. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static DateTimeOffset FromUnixTimeSeconds(this uint value) { return DateTimeOffset.FromUnixTimeSeconds(value); @@ -61,7 +61,7 @@ public static class UInt32Extensions /// /// is 0. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool IsLeapYear(this uint value) { if (value == 0) @@ -78,7 +78,7 @@ public static class UInt32Extensions /// The duration, in ticks. /// A whose will equal . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Ticks(this uint value) { return TimeSpan.FromTicks(value); @@ -92,7 +92,7 @@ public static class UInt32Extensions /// A whose will equal . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Milliseconds(this uint value) { return TimeSpan.FromMilliseconds(value); @@ -106,7 +106,7 @@ public static class UInt32Extensions /// A whose will equal . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Seconds(this uint value) { return TimeSpan.FromSeconds(value); @@ -120,7 +120,7 @@ public static class UInt32Extensions /// A whose will equal . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Minutes(this uint value) { return TimeSpan.FromMinutes(value); @@ -134,7 +134,7 @@ public static class UInt32Extensions /// A whose will equal . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Hours(this uint value) { return TimeSpan.FromHours(value); @@ -146,7 +146,7 @@ public static class UInt32Extensions /// The duration, in days. /// A whose will equal . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Days(this uint value) { return TimeSpan.FromDays(value); @@ -160,7 +160,7 @@ public static class UInt32Extensions /// A whose will equal × 7. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Weeks(this uint value) { return TimeSpan.FromDays(value * 7); diff --git a/X10D/src/Time/UInt64Extensions.cs b/X10D/src/Time/UInt64Extensions.cs index bb902b6..c1c47ac 100644 --- a/X10D/src/Time/UInt64Extensions.cs +++ b/X10D/src/Time/UInt64Extensions.cs @@ -25,7 +25,7 @@ public static class UInt64Extensions /// is greater than 253,402,300,799,999. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static DateTimeOffset FromUnixTimeMilliseconds(this ulong value) { return DateTimeOffset.FromUnixTimeMilliseconds((long)value); @@ -46,7 +46,7 @@ public static class UInt64Extensions /// is greater than 253,402,300,799. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static DateTimeOffset FromUnixTimeSeconds(this ulong value) { return DateTimeOffset.FromUnixTimeSeconds((long)value); @@ -61,7 +61,7 @@ public static class UInt64Extensions /// /// is 0. [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static bool IsLeapYear(this ulong value) { if (value == 0) @@ -78,7 +78,7 @@ public static class UInt64Extensions /// The duration, in ticks. /// A whose will equal . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Ticks(this ulong value) { return TimeSpan.FromTicks((long)value); @@ -92,7 +92,7 @@ public static class UInt64Extensions /// A whose will equal . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Milliseconds(this ulong value) { return TimeSpan.FromMilliseconds((long)value); @@ -106,7 +106,7 @@ public static class UInt64Extensions /// A whose will equal . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Seconds(this ulong value) { return TimeSpan.FromSeconds((long)value); @@ -120,7 +120,7 @@ public static class UInt64Extensions /// A whose will equal . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Minutes(this ulong value) { return TimeSpan.FromMinutes((long)value); @@ -134,7 +134,7 @@ public static class UInt64Extensions /// A whose will equal . /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Hours(this ulong value) { return TimeSpan.FromHours((long)value); @@ -146,7 +146,7 @@ public static class UInt64Extensions /// The duration, in days. /// A whose will equal . [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Days(this ulong value) { return TimeSpan.FromDays((long)value); @@ -160,7 +160,7 @@ public static class UInt64Extensions /// A whose will equal × 7. /// [Pure] - [MethodImpl(CompilerResources.MethodImplOptions)] + [MethodImpl(CompilerResources.MaxOptimization)] public static TimeSpan Weeks(this ulong value) { return TimeSpan.FromDays((long)value * 7);