From 19eab4d7afac002879168db92e663db2ebf10ebf Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Sun, 26 Feb 2023 03:43:52 +0100 Subject: [PATCH] Adjust aggressive inlining attributes on throw helpers --- .../Polyfills/ArgumentNullExceptionExtensions.cs | 1 - .../Polyfills/ArgumentOutOfRangeExceptionExtensions.cs | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ComputeSharp.Core/Polyfills/ArgumentNullExceptionExtensions.cs b/src/ComputeSharp.Core/Polyfills/ArgumentNullExceptionExtensions.cs index 9255dda0..640cc2ec 100644 --- a/src/ComputeSharp.Core/Polyfills/ArgumentNullExceptionExtensions.cs +++ b/src/ComputeSharp.Core/Polyfills/ArgumentNullExceptionExtensions.cs @@ -14,7 +14,6 @@ internal static class ArgumentNullExceptionExtensions /// Dummy value to invoke the extension upon (always pass . /// The name of the parameter to report in the exception. /// Thrown with . - [MethodImpl(MethodImplOptions.AggressiveInlining)] [DoesNotReturn] public static void Throw(this ArgumentNullException? _, string? parameterName) { diff --git a/src/ComputeSharp.Core/Polyfills/ArgumentOutOfRangeExceptionExtensions.cs b/src/ComputeSharp.Core/Polyfills/ArgumentOutOfRangeExceptionExtensions.cs index 0e2d4cb0..0e617bdf 100644 --- a/src/ComputeSharp.Core/Polyfills/ArgumentOutOfRangeExceptionExtensions.cs +++ b/src/ComputeSharp.Core/Polyfills/ArgumentOutOfRangeExceptionExtensions.cs @@ -14,6 +14,7 @@ internal static class ArgumentOutOfRangeExceptionExtensions /// Dummy value to invoke the extension upon (always pass . /// The argument to validate as zero. /// The name of the parameter with which corresponds. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void ThrowIfNotZero(this ArgumentOutOfRangeException? _, int value, [CallerArgumentExpression(nameof(value))] string? parameterName = null) { if (value != 0) @@ -59,6 +60,7 @@ internal static class ArgumentOutOfRangeExceptionExtensions /// The argument to validate as less or equal than . /// The value to compare with . /// The name of the parameter with which corresponds. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void ThrowIfGreaterThan(this ArgumentOutOfRangeException? _, int value, int other, [CallerArgumentExpression(nameof(value))] string? parameterName = null) { if (value > other) @@ -74,6 +76,7 @@ internal static class ArgumentOutOfRangeExceptionExtensions /// The argument to validate as less or equal than . /// The value to compare with . /// The name of the parameter with which corresponds. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void ThrowIfLessThan(this ArgumentOutOfRangeException? _, int value, int other, [CallerArgumentExpression(nameof(value))] string? parameterName = null) { if (value < other) @@ -89,6 +92,7 @@ internal static class ArgumentOutOfRangeExceptionExtensions /// The argument to validate as less or equal than . /// The value to compare with . /// The name of the parameter with which corresponds. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void ThrowIfLessThan(this ArgumentOutOfRangeException? _, long value, long other, [CallerArgumentExpression(nameof(value))] string? parameterName = null) { if (value < other)