Browse Source

PR feedback

pull/2189/head
James Jackson-South 4 years ago
parent
commit
61299f99ef
  1. 10
      src/ImageSharp/Common/Helpers/RuntimeUtility.cs
  2. 4
      src/ImageSharp/Formats/Webp/Lossy/Vp8EncIterator.cs

10
src/ImageSharp/Common/Helpers/RuntimeUtility.cs

@ -1,4 +1,4 @@
// Copyright (c) Six Labors. // Copyright (c) Six Labors.
// Licensed under the Six Labors Split License. // Licensed under the Six Labors Split License.
using System; using System;
@ -11,6 +11,8 @@ namespace SixLabors.ImageSharp.Common.Helpers
/// </summary> /// </summary>
internal static class RuntimeUtility internal static class RuntimeUtility
{ {
// Tuple swap uses 2 more IL bytes
#pragma warning disable IDE0180 // Use tuple to swap values
/// <summary> /// <summary>
/// Swaps the two references. /// Swaps the two references.
/// </summary> /// </summary>
@ -20,10 +22,7 @@ namespace SixLabors.ImageSharp.Common.Helpers
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void Swap<T>(ref T a, ref T b) public static void Swap<T>(ref T a, ref T b)
{ {
// Tuple swap uses 2 more IL bytes
#pragma warning disable IDE0180 // Use tuple to swap values
T tmp = a; T tmp = a;
#pragma warning restore IDE0180 // Use tuple to swap values
a = b; a = b;
b = tmp; b = tmp;
} }
@ -38,11 +37,10 @@ namespace SixLabors.ImageSharp.Common.Helpers
public static void Swap<T>(ref Span<T> a, ref Span<T> b) public static void Swap<T>(ref Span<T> a, ref Span<T> b)
{ {
// Tuple swap uses 2 more IL bytes // Tuple swap uses 2 more IL bytes
#pragma warning disable IDE0180 // Use tuple to swap values
Span<T> tmp = a; Span<T> tmp = a;
#pragma warning restore IDE0180 // Use tuple to swap values
a = b; a = b;
b = tmp; b = tmp;
} }
#pragma warning restore IDE0180 // Use tuple to swap values
} }
} }

4
src/ImageSharp/Formats/Webp/Lossy/Vp8EncIterator.cs

@ -2,7 +2,6 @@
// Licensed under the Six Labors Split License. // Licensed under the Six Labors Split License.
using System; using System;
using SixLabors.ImageSharp.Common.Helpers;
namespace SixLabors.ImageSharp.Formats.Webp.Lossy namespace SixLabors.ImageSharp.Formats.Webp.Lossy
{ {
@ -755,11 +754,12 @@ namespace SixLabors.ImageSharp.Formats.Webp.Lossy
public void SwapOut() public void SwapOut()
{ {
// Tuple swap uses 2 more IL bytes
#pragma warning disable IDE0180 // Use tuple to swap values #pragma warning disable IDE0180 // Use tuple to swap values
byte[] tmp = this.YuvOut; byte[] tmp = this.YuvOut;
#pragma warning restore IDE0180 // Use tuple to swap values
this.YuvOut = this.YuvOut2; this.YuvOut = this.YuvOut2;
this.YuvOut2 = tmp; this.YuvOut2 = tmp;
#pragma warning restore IDE0180 // Use tuple to swap values
} }
public void NzToBytes() public void NzToBytes()

Loading…
Cancel
Save