From eedc89e588e89257564c78f1999f5ce47d957734 Mon Sep 17 00:00:00 2001 From: Jason Nelson Date: Mon, 15 Oct 2018 16:07:07 -0700 Subject: [PATCH] Use BitConverter.IsLittleEndian directly This allows the JIT can optimize away the unused branch --- .../MetaData/Profiles/ICC/DataWriter/IccDataWriter.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/ImageSharp/MetaData/Profiles/ICC/DataWriter/IccDataWriter.cs b/src/ImageSharp/MetaData/Profiles/ICC/DataWriter/IccDataWriter.cs index e509f67d7..21b7b6421 100644 --- a/src/ImageSharp/MetaData/Profiles/ICC/DataWriter/IccDataWriter.cs +++ b/src/ImageSharp/MetaData/Profiles/ICC/DataWriter/IccDataWriter.cs @@ -11,8 +11,6 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc /// internal sealed partial class IccDataWriter : IDisposable { - private static readonly bool IsLittleEndian = BitConverter.IsLittleEndian; - /// /// The underlying stream where the data is written to /// @@ -179,7 +177,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc /// The number of bytes written private unsafe int WriteBytes(byte* data, int length) { - if (IsLittleEndian) + if (BitConverter.IsLittleEndian) { for (int i = length - 1; i >= 0; i--) {