From 8b2e164c83a7fc910a6f84c686f8dc12e1350291 Mon Sep 17 00:00:00 2001 From: Stefan Nikolei Date: Mon, 20 Nov 2023 08:17:54 +0100 Subject: [PATCH] Fix CA1857 --- src/ImageSharp.ruleset | 1 - src/ImageSharp/Common/Helpers/SimdUtils.HwIntrinsics.cs | 5 +++-- src/ImageSharp/Common/Helpers/SimdUtils.Shuffle.cs | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/ImageSharp.ruleset b/src/ImageSharp.ruleset index 11f504158..8327dd756 100644 --- a/src/ImageSharp.ruleset +++ b/src/ImageSharp.ruleset @@ -2,7 +2,6 @@ - diff --git a/src/ImageSharp/Common/Helpers/SimdUtils.HwIntrinsics.cs b/src/ImageSharp/Common/Helpers/SimdUtils.HwIntrinsics.cs index 7caaa5868..373069e9b 100644 --- a/src/ImageSharp/Common/Helpers/SimdUtils.HwIntrinsics.cs +++ b/src/ImageSharp/Common/Helpers/SimdUtils.HwIntrinsics.cs @@ -1,6 +1,7 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. +using System.Diagnostics.CodeAnalysis; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Intrinsics; @@ -58,7 +59,7 @@ internal static partial class SimdUtils public static void Shuffle4Reduce( ref ReadOnlySpan source, ref Span dest, - byte control) + [ConstantExpected] byte control) { if (Avx.IsSupported || Sse.IsSupported) { @@ -217,7 +218,7 @@ internal static partial class SimdUtils private static void Shuffle4( ReadOnlySpan source, Span dest, - byte control) + [ConstantExpected] byte control) { if (Avx.IsSupported) { diff --git a/src/ImageSharp/Common/Helpers/SimdUtils.Shuffle.cs b/src/ImageSharp/Common/Helpers/SimdUtils.Shuffle.cs index c1437c05e..83cd3d246 100644 --- a/src/ImageSharp/Common/Helpers/SimdUtils.Shuffle.cs +++ b/src/ImageSharp/Common/Helpers/SimdUtils.Shuffle.cs @@ -2,6 +2,7 @@ // Licensed under the Six Labors Split License. using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; @@ -20,7 +21,7 @@ internal static partial class SimdUtils public static void Shuffle4( ReadOnlySpan source, Span dest, - byte control) + [ConstantExpected] byte control) { VerifyShuffle4SpanInput(source, dest);