diff --git a/src/ImageSharp/ColorSpaces/CieLab.cs b/src/ImageSharp/ColorSpaces/CieLab.cs index dd01ea5f4b..146acf12ee 100644 --- a/src/ImageSharp/ColorSpaces/CieLab.cs +++ b/src/ImageSharp/ColorSpaces/CieLab.cs @@ -118,14 +118,7 @@ namespace SixLabors.ImageSharp.ColorSpaces public static bool operator !=(CieLab left, CieLab right) => !left.Equals(right); /// - public override int GetHashCode() - { - return HashHelpers.Combine( - this.L.GetHashCode(), - this.A.GetHashCode(), - this.B.GetHashCode(), - this.WhitePoint.GetHashCode()); - } + public override int GetHashCode() => HashCode.Combine(this.L, this.A, this.B, this.WhitePoint); /// public override string ToString() => FormattableString.Invariant($"CieLab({this.L:#0.##}, {this.A:#0.##}, {this.B:#0.##})"); diff --git a/src/ImageSharp/ColorSpaces/CieLch.cs b/src/ImageSharp/ColorSpaces/CieLch.cs index fffd368fb4..074bc1516b 100644 --- a/src/ImageSharp/ColorSpaces/CieLch.cs +++ b/src/ImageSharp/ColorSpaces/CieLch.cs @@ -122,11 +122,7 @@ namespace SixLabors.ImageSharp.ColorSpaces /// public override int GetHashCode() { - return HashHelpers.Combine( - this.L.GetHashCode(), - this.C.GetHashCode(), - this.H.GetHashCode(), - this.WhitePoint.GetHashCode()); + return HashCode.Combine(this.L, this.C, this.H, this.WhitePoint); } /// diff --git a/src/ImageSharp/ColorSpaces/CieLchuv.cs b/src/ImageSharp/ColorSpaces/CieLchuv.cs index 829abbf0ec..ab6f639a2b 100644 --- a/src/ImageSharp/ColorSpaces/CieLchuv.cs +++ b/src/ImageSharp/ColorSpaces/CieLchuv.cs @@ -119,14 +119,7 @@ namespace SixLabors.ImageSharp.ColorSpaces public static bool operator !=(CieLchuv left, CieLchuv right) => !left.Equals(right); /// - public override int GetHashCode() - { - return HashHelpers.Combine( - this.L.GetHashCode(), - this.C.GetHashCode(), - this.H.GetHashCode(), - this.WhitePoint.GetHashCode()); - } + public override int GetHashCode() => HashCode.Combine(this.L, this.C, this.H, this.WhitePoint); /// public override string ToString() => FormattableString.Invariant($"CieLchuv({this.L:#0.##}, {this.C:#0.##}, {this.H:#0.##})"); diff --git a/src/ImageSharp/ColorSpaces/CieLuv.cs b/src/ImageSharp/ColorSpaces/CieLuv.cs index b678084c38..d54d92b62a 100644 --- a/src/ImageSharp/ColorSpaces/CieLuv.cs +++ b/src/ImageSharp/ColorSpaces/CieLuv.cs @@ -119,14 +119,7 @@ namespace SixLabors.ImageSharp.ColorSpaces public static bool operator !=(CieLuv left, CieLuv right) => !left.Equals(right); /// - public override int GetHashCode() - { - return HashHelpers.Combine( - this.L.GetHashCode(), - this.U.GetHashCode(), - this.V.GetHashCode(), - this.WhitePoint.GetHashCode()); - } + public override int GetHashCode() => HashCode.Combine(this.L, this.U, this.V, this.WhitePoint); /// public override string ToString() => FormattableString.Invariant($"CieLuv({this.L:#0.##}, {this.U:#0.##}, {this.V:#0.##})"); diff --git a/src/ImageSharp/ColorSpaces/CieXyChromaticityCoordinates.cs b/src/ImageSharp/ColorSpaces/CieXyChromaticityCoordinates.cs index f625bb7616..49c1da9f10 100644 --- a/src/ImageSharp/ColorSpaces/CieXyChromaticityCoordinates.cs +++ b/src/ImageSharp/ColorSpaces/CieXyChromaticityCoordinates.cs @@ -64,7 +64,7 @@ namespace SixLabors.ImageSharp.ColorSpaces /// [MethodImpl(InliningOptions.ShortMethod)] - public override int GetHashCode() => HashHelpers.Combine(this.X.GetHashCode(), this.Y.GetHashCode()); + public override int GetHashCode() => HashCode.Combine(this.X, this.Y); /// public override string ToString() => FormattableString.Invariant($"CieXyChromaticityCoordinates({this.X:#0.##}, {this.Y:#0.##})"); diff --git a/src/ImageSharp/ColorSpaces/CieXyy.cs b/src/ImageSharp/ColorSpaces/CieXyy.cs index 1d5d2de53c..fff296945e 100644 --- a/src/ImageSharp/ColorSpaces/CieXyy.cs +++ b/src/ImageSharp/ColorSpaces/CieXyy.cs @@ -83,13 +83,7 @@ namespace SixLabors.ImageSharp.ColorSpaces public static bool operator !=(CieXyy left, CieXyy right) => !left.Equals(right); /// - public override int GetHashCode() - { - return HashHelpers.Combine( - this.X.GetHashCode(), - this.Y.GetHashCode(), - this.Yl.GetHashCode()); - } + public override int GetHashCode() => HashCode.Combine(this.X, this.Y, this.Yl); /// public override string ToString() => FormattableString.Invariant($"CieXyy({this.X:#0.##}, {this.Y:#0.##}, {this.Yl:#0.##})"); diff --git a/src/ImageSharp/ColorSpaces/CieXyz.cs b/src/ImageSharp/ColorSpaces/CieXyz.cs index 6c9ea65e66..30521476e5 100644 --- a/src/ImageSharp/ColorSpaces/CieXyz.cs +++ b/src/ImageSharp/ColorSpaces/CieXyz.cs @@ -86,13 +86,7 @@ namespace SixLabors.ImageSharp.ColorSpaces public Vector3 ToVector3() => new Vector3(this.X, this.Y, this.Z); /// - public override int GetHashCode() - { - return HashHelpers.Combine( - this.X.GetHashCode(), - this.Y.GetHashCode(), - this.Z.GetHashCode()); - } + public override int GetHashCode() => HashCode.Combine(this.X, this.Y, this.Z); /// public override string ToString() => FormattableString.Invariant($"CieXyz({this.X:#0.##}, {this.Y:#0.##}, {this.Z:#0.##})"); diff --git a/src/ImageSharp/ColorSpaces/Cmyk.cs b/src/ImageSharp/ColorSpaces/Cmyk.cs index 241a8b325f..04901126c1 100644 --- a/src/ImageSharp/ColorSpaces/Cmyk.cs +++ b/src/ImageSharp/ColorSpaces/Cmyk.cs @@ -90,14 +90,7 @@ namespace SixLabors.ImageSharp.ColorSpaces /// [MethodImpl(InliningOptions.ShortMethod)] - public override int GetHashCode() - { - return HashHelpers.Combine( - this.C.GetHashCode(), - this.M.GetHashCode(), - this.Y.GetHashCode(), - this.K.GetHashCode()); - } + public override int GetHashCode() => HashCode.Combine(this.C, this.M, this.Y, this.K); /// public override string ToString() => FormattableString.Invariant($"Cmyk({this.C:#0.##}, {this.M:#0.##}, {this.Y:#0.##}, {this.K:#0.##})"); diff --git a/src/ImageSharp/ColorSpaces/Conversion/Implementation/RGBPrimariesChromaticityCoordinates.cs b/src/ImageSharp/ColorSpaces/Conversion/Implementation/RGBPrimariesChromaticityCoordinates.cs index ba6da5a85a..4c69133e0f 100644 --- a/src/ImageSharp/ColorSpaces/Conversion/Implementation/RGBPrimariesChromaticityCoordinates.cs +++ b/src/ImageSharp/ColorSpaces/Conversion/Implementation/RGBPrimariesChromaticityCoordinates.cs @@ -86,9 +86,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion.Implementation } /// - public override int GetHashCode() - { - return HashHelpers.Combine(this.R.GetHashCode(), this.G.GetHashCode(), this.B.GetHashCode()); - } + public override int GetHashCode() => HashCode.Combine(this.R, this.G, this.B); } } \ No newline at end of file diff --git a/src/ImageSharp/ColorSpaces/Conversion/Implementation/WorkingSpaces/GammaWorkingSpace.cs b/src/ImageSharp/ColorSpaces/Conversion/Implementation/WorkingSpaces/GammaWorkingSpace.cs index 271278ad78..639d0b2933 100644 --- a/src/ImageSharp/ColorSpaces/Conversion/Implementation/WorkingSpaces/GammaWorkingSpace.cs +++ b/src/ImageSharp/ColorSpaces/Conversion/Implementation/WorkingSpaces/GammaWorkingSpace.cs @@ -1,6 +1,7 @@ // Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. +using System; using System.Runtime.CompilerServices; using SixLabors.ImageSharp.ColorSpaces.Companding; @@ -57,6 +58,9 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion.Implementation } /// - public override int GetHashCode() => HashHelpers.Combine(base.GetHashCode(), this.Gamma.GetHashCode()); + public override int GetHashCode() => HashCode.Combine( + this.WhitePoint, + this.ChromaticityCoordinates, + this.Gamma); } } \ No newline at end of file diff --git a/src/ImageSharp/ColorSpaces/Conversion/Implementation/WorkingSpaces/RgbWorkingSpaceBase.cs b/src/ImageSharp/ColorSpaces/Conversion/Implementation/WorkingSpaces/RgbWorkingSpaceBase.cs index 70d3cccedc..6051f52865 100644 --- a/src/ImageSharp/ColorSpaces/Conversion/Implementation/WorkingSpaces/RgbWorkingSpaceBase.cs +++ b/src/ImageSharp/ColorSpaces/Conversion/Implementation/WorkingSpaces/RgbWorkingSpaceBase.cs @@ -1,6 +1,8 @@ // Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. +using System; + namespace SixLabors.ImageSharp.ColorSpaces.Conversion.Implementation { /// @@ -76,7 +78,7 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion.Implementation /// public override int GetHashCode() { - return HashHelpers.Combine(this.WhitePoint.GetHashCode(), this.ChromaticityCoordinates.GetHashCode()); + return HashCode.Combine(this.WhitePoint, this.ChromaticityCoordinates); } } } \ No newline at end of file diff --git a/src/ImageSharp/ColorSpaces/Hsl.cs b/src/ImageSharp/ColorSpaces/Hsl.cs index 1b92d5e88f..04b3bea41f 100644 --- a/src/ImageSharp/ColorSpaces/Hsl.cs +++ b/src/ImageSharp/ColorSpaces/Hsl.cs @@ -84,13 +84,7 @@ namespace SixLabors.ImageSharp.ColorSpaces /// [MethodImpl(InliningOptions.ShortMethod)] - public override int GetHashCode() - { - return HashHelpers.Combine( - this.H.GetHashCode(), - this.S.GetHashCode(), - this.L.GetHashCode()); - } + public override int GetHashCode() => HashCode.Combine(this.H, this.S, this.L); /// public override string ToString() => FormattableString.Invariant($"Hsl({this.H:#0.##}, {this.S:#0.##}, {this.L:#0.##})"); diff --git a/src/ImageSharp/ColorSpaces/Hsv.cs b/src/ImageSharp/ColorSpaces/Hsv.cs index 56d798af05..8ccc74ae09 100644 --- a/src/ImageSharp/ColorSpaces/Hsv.cs +++ b/src/ImageSharp/ColorSpaces/Hsv.cs @@ -82,13 +82,7 @@ namespace SixLabors.ImageSharp.ColorSpaces /// [MethodImpl(InliningOptions.ShortMethod)] - public override int GetHashCode() - { - return HashHelpers.Combine( - this.H.GetHashCode(), - this.S.GetHashCode(), - this.V.GetHashCode()); - } + public override int GetHashCode() => HashCode.Combine(this.H, this.S, this.V); /// public override string ToString() => FormattableString.Invariant($"Hsv({this.H:#0.##}, {this.S:#0.##}, {this.V:#0.##})"); diff --git a/src/ImageSharp/ColorSpaces/HunterLab.cs b/src/ImageSharp/ColorSpaces/HunterLab.cs index 1aa7be601f..dcae65e425 100644 --- a/src/ImageSharp/ColorSpaces/HunterLab.cs +++ b/src/ImageSharp/ColorSpaces/HunterLab.cs @@ -119,11 +119,7 @@ namespace SixLabors.ImageSharp.ColorSpaces [MethodImpl(InliningOptions.ShortMethod)] public override int GetHashCode() { - return HashHelpers.Combine( - this.L.GetHashCode(), - this.A.GetHashCode(), - this.B.GetHashCode(), - this.WhitePoint.GetHashCode()); + return HashCode.Combine(this.L, this.A, this.B, this.WhitePoint); } /// diff --git a/src/ImageSharp/ColorSpaces/LinearRgb.cs b/src/ImageSharp/ColorSpaces/LinearRgb.cs index fba27a41e9..46b2275968 100644 --- a/src/ImageSharp/ColorSpaces/LinearRgb.cs +++ b/src/ImageSharp/ColorSpaces/LinearRgb.cs @@ -126,13 +126,7 @@ namespace SixLabors.ImageSharp.ColorSpaces /// [MethodImpl(InliningOptions.ShortMethod)] - public override int GetHashCode() - { - return HashHelpers.Combine( - this.R.GetHashCode(), - this.G.GetHashCode(), - this.B.GetHashCode()); - } + public override int GetHashCode() => HashCode.Combine(this.R, this.G, this.B); /// public override string ToString() => FormattableString.Invariant($"LinearRgb({this.R:#0.##}, {this.G:#0.##}, {this.B:#0.##})"); diff --git a/src/ImageSharp/ColorSpaces/Lms.cs b/src/ImageSharp/ColorSpaces/Lms.cs index 0177c9712f..0ee56abbc2 100644 --- a/src/ImageSharp/ColorSpaces/Lms.cs +++ b/src/ImageSharp/ColorSpaces/Lms.cs @@ -87,13 +87,7 @@ namespace SixLabors.ImageSharp.ColorSpaces public Vector3 ToVector3() => new Vector3(this.L, this.M, this.S); /// - public override int GetHashCode() - { - return HashHelpers.Combine( - this.L.GetHashCode(), - this.M.GetHashCode(), - this.S.GetHashCode()); - } + public override int GetHashCode() => HashCode.Combine(this.L, this.M, this.S); /// public override string ToString() => FormattableString.Invariant($"Lms({this.L:#0.##}, {this.M:#0.##}, {this.S:#0.##})"); diff --git a/src/ImageSharp/ColorSpaces/Rgb.cs b/src/ImageSharp/ColorSpaces/Rgb.cs index ef44d217e9..cdc9e90ad4 100644 --- a/src/ImageSharp/ColorSpaces/Rgb.cs +++ b/src/ImageSharp/ColorSpaces/Rgb.cs @@ -147,13 +147,7 @@ namespace SixLabors.ImageSharp.ColorSpaces public Vector3 ToVector3() => new Vector3(this.R, this.G, this.B); /// - public override int GetHashCode() - { - return HashHelpers.Combine( - this.R.GetHashCode(), - this.G.GetHashCode(), - this.B.GetHashCode()); - } + public override int GetHashCode() => HashCode.Combine(this.R, this.G, this.B); /// public override string ToString() => FormattableString.Invariant($"Rgb({this.R:#0.##}, {this.G:#0.##}, {this.B:#0.##})"); diff --git a/src/ImageSharp/ColorSpaces/YCbCr.cs b/src/ImageSharp/ColorSpaces/YCbCr.cs index 2287d36894..b0563bb899 100644 --- a/src/ImageSharp/ColorSpaces/YCbCr.cs +++ b/src/ImageSharp/ColorSpaces/YCbCr.cs @@ -83,13 +83,7 @@ namespace SixLabors.ImageSharp.ColorSpaces /// [MethodImpl(InliningOptions.ShortMethod)] - public override int GetHashCode() - { - return HashHelpers.Combine( - this.Y.GetHashCode(), - this.Cb.GetHashCode(), - this.Cr.GetHashCode()); - } + public override int GetHashCode() => HashCode.Combine(this.Y, this.Cb, this.Cr); /// public override string ToString() => FormattableString.Invariant($"YCbCr({this.Y}, {this.Cb}, {this.Cr})"); diff --git a/src/ImageSharp/Formats/Jpeg/Components/Decoder/AdobeMarker.cs b/src/ImageSharp/Formats/Jpeg/Components/Decoder/AdobeMarker.cs index 1fa09605ef..43de39ac78 100644 --- a/src/ImageSharp/Formats/Jpeg/Components/Decoder/AdobeMarker.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/Decoder/AdobeMarker.cs @@ -100,11 +100,11 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder /// public override int GetHashCode() { - return HashHelpers.Combine( - this.DCTEncodeVersion.GetHashCode(), - this.APP14Flags0.GetHashCode(), - this.APP14Flags1.GetHashCode(), - this.ColorTransform.GetHashCode()); + return HashCode.Combine( + this.DCTEncodeVersion, + this.APP14Flags0, + this.APP14Flags1, + this.ColorTransform); } } } \ No newline at end of file diff --git a/src/ImageSharp/Formats/Jpeg/Components/Decoder/JFifMarker.cs b/src/ImageSharp/Formats/Jpeg/Components/Decoder/JFifMarker.cs index 4bff492486..c51a2f4da5 100644 --- a/src/ImageSharp/Formats/Jpeg/Components/Decoder/JFifMarker.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/Decoder/JFifMarker.cs @@ -112,13 +112,12 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder /// public override int GetHashCode() { - return HashHelpers.Combine( - this.MajorVersion.GetHashCode(), - HashHelpers.Combine( - this.MinorVersion.GetHashCode(), - HashHelpers.Combine( - this.DensityUnits.GetHashCode(), - HashHelpers.Combine(this.XDensity, this.YDensity)))); + return HashCode.Combine( + this.MajorVersion, + this.MinorVersion, + this.DensityUnits, + this.XDensity, + this.YDensity); } } } \ No newline at end of file diff --git a/src/ImageSharp/ImageSharp.csproj b/src/ImageSharp/ImageSharp.csproj index 98132edd68..1cdee81a26 100644 --- a/src/ImageSharp/ImageSharp.csproj +++ b/src/ImageSharp/ImageSharp.csproj @@ -38,7 +38,7 @@ - + All diff --git a/src/ImageSharp/MetaData/ImageProperty.cs b/src/ImageSharp/MetaData/ImageProperty.cs index 4644f9b68d..24a3686de2 100644 --- a/src/ImageSharp/MetaData/ImageProperty.cs +++ b/src/ImageSharp/MetaData/ImageProperty.cs @@ -99,19 +99,7 @@ namespace SixLabors.ImageSharp.MetaData /// /// A 32-bit signed integer that is the hash code for this instance. /// - public override int GetHashCode() - { - unchecked - { - int hashCode = this.Name.GetHashCode(); - if (this.Value != null) - { - hashCode = HashHelpers.Combine(hashCode, this.Value.GetHashCode()); - } - - return hashCode; - } - } + public override int GetHashCode() => HashCode.Combine(this.Name, this.Value); /// /// Returns the fully qualified type name of this instance. diff --git a/src/ImageSharp/MetaData/Profiles/Exif/ExifValue.cs b/src/ImageSharp/MetaData/Profiles/Exif/ExifValue.cs index c5332788f3..409c55253a 100644 --- a/src/ImageSharp/MetaData/Profiles/Exif/ExifValue.cs +++ b/src/ImageSharp/MetaData/Profiles/Exif/ExifValue.cs @@ -200,11 +200,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Exif /// public override int GetHashCode() { - int hashCode = HashHelpers.Combine(this.Tag.GetHashCode(), this.DataType.GetHashCode()); - - return this.Value != null - ? HashHelpers.Combine(hashCode, this.Value.GetHashCode()) - : hashCode; + return HashCode.Combine(this.Tag, this.DataType, this.Value); } /// diff --git a/src/ImageSharp/MetaData/Profiles/ICC/Curves/IccParametricCurve.cs b/src/ImageSharp/MetaData/Profiles/ICC/Curves/IccParametricCurve.cs index 0f50b366c7..efc2ca5377 100644 --- a/src/ImageSharp/MetaData/Profiles/ICC/Curves/IccParametricCurve.cs +++ b/src/ImageSharp/MetaData/Profiles/ICC/Curves/IccParametricCurve.cs @@ -154,18 +154,15 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc /// public override int GetHashCode() { - unchecked - { - int hashCode = this.Type.GetHashCode(); - hashCode = HashHelpers.Combine(hashCode, this.G.GetHashCode()); - hashCode = HashHelpers.Combine(hashCode, this.A.GetHashCode()); - hashCode = HashHelpers.Combine(hashCode, this.B.GetHashCode()); - hashCode = HashHelpers.Combine(hashCode, this.C.GetHashCode()); - hashCode = HashHelpers.Combine(hashCode, this.D.GetHashCode()); - hashCode = HashHelpers.Combine(hashCode, this.E.GetHashCode()); - hashCode = HashHelpers.Combine(hashCode, this.F.GetHashCode()); - return hashCode; - } + return HashCode.Combine( + this.Type, + this.G.GetHashCode(), + this.A.GetHashCode(), + this.B.GetHashCode(), + this.C.GetHashCode(), + this.D.GetHashCode(), + this.E.GetHashCode(), + this.F.GetHashCode()); } } } diff --git a/src/ImageSharp/MetaData/Profiles/ICC/Curves/IccResponseCurve.cs b/src/ImageSharp/MetaData/Profiles/ICC/Curves/IccResponseCurve.cs index 04984a4f24..de08485ac8 100644 --- a/src/ImageSharp/MetaData/Profiles/ICC/Curves/IccResponseCurve.cs +++ b/src/ImageSharp/MetaData/Profiles/ICC/Curves/IccResponseCurve.cs @@ -73,10 +73,10 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc /// public override int GetHashCode() { - return HashHelpers.Combine( - this.CurveType.GetHashCode(), - this.XyzValues.GetHashCode(), - this.ResponseArrays.GetHashCode()); + return HashCode.Combine( + this.CurveType, + this.XyzValues, + this.ResponseArrays); } private bool EqualsResponseArray(IccResponseCurve other) diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccChromaticityTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccChromaticityTagDataEntry.cs index 0b2aa7afc8..e9a812d8ca 100644 --- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccChromaticityTagDataEntry.cs +++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccChromaticityTagDataEntry.cs @@ -110,10 +110,10 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc /// public override int GetHashCode() { - return HashHelpers.Combine( - base.GetHashCode(), - this.ColorantType.GetHashCode(), - this.ChannelValues.GetHashCode()); + return HashCode.Combine( + this.Signature, + this.ColorantType, + this.ChannelValues); } private static double[][] GetColorantArray(IccColorantEncoding colorantType) diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccColorantOrderTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccColorantOrderTagDataEntry.cs index 5b8526b7de..b5f8fd5c49 100644 --- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccColorantOrderTagDataEntry.cs +++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccColorantOrderTagDataEntry.cs @@ -70,7 +70,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc /// public override int GetHashCode() { - return HashHelpers.Combine(base.GetHashCode(), this.ColorantNumber.GetHashCode()); + return HashCode.Combine(this.Signature, this.ColorantNumber); } } } \ No newline at end of file diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccColorantTableTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccColorantTableTagDataEntry.cs index 572df8cb8d..9f2b4c90ad 100644 --- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccColorantTableTagDataEntry.cs +++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccColorantTableTagDataEntry.cs @@ -72,7 +72,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc /// public override int GetHashCode() { - return HashHelpers.Combine(base.GetHashCode(), this.ColorantData.GetHashCode()); + return HashCode.Combine(this.Signature, this.ColorantData); } } } \ No newline at end of file diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccCrdInfoTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccCrdInfoTagDataEntry.cs index 9af77ba7c4..4d393dfb33 100644 --- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccCrdInfoTagDataEntry.cs +++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccCrdInfoTagDataEntry.cs @@ -121,16 +121,13 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc /// public override int GetHashCode() { - unchecked - { - int hashCode = base.GetHashCode(); - hashCode = HashHelpers.Combine(hashCode, this.PostScriptProductName?.GetHashCode() ?? 0); - hashCode = HashHelpers.Combine(hashCode, this.RenderingIntent0Crd?.GetHashCode() ?? 0); - hashCode = HashHelpers.Combine(hashCode, this.RenderingIntent1Crd?.GetHashCode() ?? 0); - hashCode = HashHelpers.Combine(hashCode, this.RenderingIntent2Crd?.GetHashCode() ?? 0); - hashCode = HashHelpers.Combine(hashCode, this.RenderingIntent3Crd?.GetHashCode() ?? 0); - return hashCode; - } + return HashCode.Combine( + this.Signature, + this.PostScriptProductName, + this.RenderingIntent0Crd, + this.RenderingIntent1Crd, + this.RenderingIntent2Crd, + this.RenderingIntent3Crd); } } } diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccCurveTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccCurveTagDataEntry.cs index 2884a2216d..0d34d3ceba 100644 --- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccCurveTagDataEntry.cs +++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccCurveTagDataEntry.cs @@ -116,9 +116,6 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc } /// - public override int GetHashCode() - { - return HashHelpers.Combine(base.GetHashCode(), this.CurveData.GetHashCode()); - } + public override int GetHashCode() => HashCode.Combine(this.Signature, this.CurveData); } } \ No newline at end of file diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccDataTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccDataTagDataEntry.cs index 9567c690c9..0b8367303d 100644 --- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccDataTagDataEntry.cs +++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccDataTagDataEntry.cs @@ -91,10 +91,10 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc /// public override int GetHashCode() { - return HashHelpers.Combine( - base.GetHashCode(), - this.Data.GetHashCode(), - this.IsAscii.GetHashCode()); + return HashCode.Combine( + this.Signature, + this.Data, + this.IsAscii); } } } \ No newline at end of file diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccDateTimeTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccDateTimeTagDataEntry.cs index 12479bb61c..104d243099 100644 --- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccDateTimeTagDataEntry.cs +++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccDateTimeTagDataEntry.cs @@ -66,7 +66,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc /// public override int GetHashCode() { - return HashHelpers.Combine(base.GetHashCode(), this.Value.GetHashCode()); + return HashCode.Combine(this.Signature, this.Value); } } } \ No newline at end of file diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccFix16ArrayTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccFix16ArrayTagDataEntry.cs index 3b9cce86bb..0a114ea1f9 100644 --- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccFix16ArrayTagDataEntry.cs +++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccFix16ArrayTagDataEntry.cs @@ -64,9 +64,6 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc } /// - public override int GetHashCode() - { - return HashHelpers.Combine(base.GetHashCode(), this.Data.GetHashCode()); - } + public override int GetHashCode() => HashCode.Combine(this.Signature, this.Data); } } \ No newline at end of file diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLut16TagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLut16TagDataEntry.cs index 281b17ba96..dd180b2997 100644 --- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLut16TagDataEntry.cs +++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLut16TagDataEntry.cs @@ -140,12 +140,12 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc /// public override int GetHashCode() { - int hashCode = base.GetHashCode(); - hashCode = HashHelpers.Combine(hashCode, this.Matrix.GetHashCode()); - hashCode = HashHelpers.Combine(hashCode, this.InputValues.GetHashCode()); - hashCode = HashHelpers.Combine(hashCode, this.ClutValues.GetHashCode()); - hashCode = HashHelpers.Combine(hashCode, this.OutputValues.GetHashCode()); - return hashCode; + return HashCode.Combine( + this.Signature, + this.Matrix, + this.InputValues, + this.ClutValues, + this.OutputValues); } private Matrix4x4 CreateMatrix(float[,] matrix) diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLut8TagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLut8TagDataEntry.cs index e3c45adb49..b345d14a54 100644 --- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLut8TagDataEntry.cs +++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLut8TagDataEntry.cs @@ -143,12 +143,12 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc /// public override int GetHashCode() { - int hashCode = base.GetHashCode(); - hashCode = HashHelpers.Combine(hashCode, this.Matrix.GetHashCode()); - hashCode = HashHelpers.Combine(hashCode, this.InputValues.GetHashCode()); - hashCode = HashHelpers.Combine(hashCode, this.ClutValues.GetHashCode()); - hashCode = HashHelpers.Combine(hashCode, this.OutputValues.GetHashCode()); - return hashCode; + return HashCode.Combine( + this.Signature, + this.Matrix, + this.InputValues, + this.ClutValues, + this.OutputValues); } private Matrix4x4 CreateMatrix(float[,] matrix) diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLutAToBTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLutAToBTagDataEntry.cs index 3dadee2da6..a6758e3330 100644 --- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLutAToBTagDataEntry.cs +++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLutAToBTagDataEntry.cs @@ -183,16 +183,14 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc /// public override int GetHashCode() { - int hashCode = base.GetHashCode(); - hashCode = HashHelpers.Combine(hashCode, this.InputChannelCount.GetHashCode()); - hashCode = HashHelpers.Combine(hashCode, this.OutputChannelCount.GetHashCode()); - hashCode = HashHelpers.Combine(hashCode, this.Matrix3x3.GetHashCode()); - hashCode = HashHelpers.Combine(hashCode, this.Matrix3x1.GetHashCode()); - hashCode = HashHelpers.Combine(hashCode, this.ClutValues?.GetHashCode() ?? 0); - hashCode = HashHelpers.Combine(hashCode, this.CurveB?.GetHashCode() ?? 0); - hashCode = HashHelpers.Combine(hashCode, this.CurveM?.GetHashCode() ?? 0); - hashCode = HashHelpers.Combine(hashCode, this.CurveA?.GetHashCode() ?? 0); - return hashCode; + return HashCode.Combine( + this.Signature, + this.InputChannelCount, + this.OutputChannelCount, + this.Matrix3x3, + this.Matrix3x1, + this.ClutValues, + HashCode.Combine(this.CurveB, this.CurveM, this.CurveA)); } private bool EqualsCurve(IccTagDataEntry[] thisCurves, IccTagDataEntry[] entryCurves) diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLutBToATagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLutBToATagDataEntry.cs index 09d0803802..6ee110199d 100644 --- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLutBToATagDataEntry.cs +++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLutBToATagDataEntry.cs @@ -183,16 +183,14 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc /// public override int GetHashCode() { - int hashCode = base.GetHashCode(); - hashCode = HashHelpers.Combine(hashCode, this.InputChannelCount.GetHashCode()); - hashCode = HashHelpers.Combine(hashCode, this.OutputChannelCount.GetHashCode()); - hashCode = HashHelpers.Combine(hashCode, this.Matrix3x3.GetHashCode()); - hashCode = HashHelpers.Combine(hashCode, this.Matrix3x1.GetHashCode()); - hashCode = HashHelpers.Combine(hashCode, this.ClutValues?.GetHashCode() ?? 0); - hashCode = HashHelpers.Combine(hashCode, this.CurveB?.GetHashCode() ?? 0); - hashCode = HashHelpers.Combine(hashCode, this.CurveM?.GetHashCode() ?? 0); - hashCode = HashHelpers.Combine(hashCode, this.CurveA?.GetHashCode() ?? 0); - return hashCode; + return HashCode.Combine( + this.Signature, + this.InputChannelCount, + this.OutputChannelCount, + this.Matrix3x3, + this.Matrix3x1, + this.ClutValues, + HashCode.Combine(this.CurveB, this.CurveM, this.CurveA)); } private bool EqualsCurve(IccTagDataEntry[] thisCurves, IccTagDataEntry[] entryCurves) diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccMeasurementTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccMeasurementTagDataEntry.cs index 6f918660ff..9247ca593f 100644 --- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccMeasurementTagDataEntry.cs +++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccMeasurementTagDataEntry.cs @@ -106,13 +106,13 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc /// public override int GetHashCode() { - int hashCode = base.GetHashCode(); - hashCode = HashHelpers.Combine(hashCode, this.Observer.GetHashCode()); - hashCode = HashHelpers.Combine(hashCode, this.XyzBacking.GetHashCode()); - hashCode = HashHelpers.Combine(hashCode, this.Geometry.GetHashCode()); - hashCode = HashHelpers.Combine(hashCode, this.Flare.GetHashCode()); - hashCode = HashHelpers.Combine(hashCode, this.Illuminant.GetHashCode()); - return hashCode; + return HashCode.Combine( + this.Signature, + this.Observer, + this.XyzBacking, + this.Geometry, + this.Flare, + this.Illuminant); } } } diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccMultiLocalizedUnicodeTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccMultiLocalizedUnicodeTagDataEntry.cs index 6f579a6b59..1a06eb5880 100644 --- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccMultiLocalizedUnicodeTagDataEntry.cs +++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccMultiLocalizedUnicodeTagDataEntry.cs @@ -66,9 +66,6 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc } /// - public override int GetHashCode() - { - return HashHelpers.Combine(base.GetHashCode(), this.Texts.GetHashCode()); - } + public override int GetHashCode() => HashCode.Combine(this.Signature, this.Texts); } } \ No newline at end of file diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccMultiProcessElementsTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccMultiProcessElementsTagDataEntry.cs index 2a983a7095..f13fdb17fb 100644 --- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccMultiProcessElementsTagDataEntry.cs +++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccMultiProcessElementsTagDataEntry.cs @@ -90,11 +90,11 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc /// public override int GetHashCode() { - return HashHelpers.Combine( - base.GetHashCode(), + return HashCode.Combine( + this.Signature, this.InputChannelCount, this.OutputChannelCount, - this.Data.GetHashCode()); + this.Data); } } } \ No newline at end of file diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccNamedColor2TagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccNamedColor2TagDataEntry.cs index 0da1f3e9fc..957b8d5c3f 100644 --- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccNamedColor2TagDataEntry.cs +++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccNamedColor2TagDataEntry.cs @@ -155,13 +155,13 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc /// public override int GetHashCode() { - int hashCode = base.GetHashCode(); - hashCode = HashHelpers.Combine(hashCode, this.CoordinateCount.GetHashCode()); - hashCode = HashHelpers.Combine(hashCode, this.Prefix?.GetHashCode() ?? 0); - hashCode = HashHelpers.Combine(hashCode, this.Suffix?.GetHashCode() ?? 0); - hashCode = HashHelpers.Combine(hashCode, this.VendorFlags.GetHashCode()); - hashCode = HashHelpers.Combine(hashCode, this.Colors.GetHashCode()); - return hashCode; + return HashCode.Combine( + this.Signature, + this.CoordinateCount, + this.Prefix, + this.Suffix, + this.VendorFlags, + this.Colors); } } } diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccParametricCurveTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccParametricCurveTagDataEntry.cs index 384129245c..9ec497d3be 100644 --- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccParametricCurveTagDataEntry.cs +++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccParametricCurveTagDataEntry.cs @@ -65,9 +65,6 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc } /// - public override int GetHashCode() - { - return HashHelpers.Combine(base.GetHashCode(), this.Curve.GetHashCode()); - } + public override int GetHashCode() => HashCode.Combine(this.Signature, this.Curve); } } diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccProfileSequenceDescTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccProfileSequenceDescTagDataEntry.cs index a337d76ef5..ff69115267 100644 --- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccProfileSequenceDescTagDataEntry.cs +++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccProfileSequenceDescTagDataEntry.cs @@ -67,9 +67,6 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc } /// - public override int GetHashCode() - { - return HashHelpers.Combine(base.GetHashCode(), this.Descriptions.GetHashCode()); - } + public override int GetHashCode() => HashCode.Combine(this.Signature, this.Descriptions); } } diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccProfileSequenceIdentifierTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccProfileSequenceIdentifierTagDataEntry.cs index 9c199bfdb5..c6cc0903c5 100644 --- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccProfileSequenceIdentifierTagDataEntry.cs +++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccProfileSequenceIdentifierTagDataEntry.cs @@ -65,9 +65,6 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc } /// - public override int GetHashCode() - { - return HashHelpers.Combine(base.GetHashCode(), this.Data.GetHashCode()); - } + public override int GetHashCode() => HashCode.Combine(this.Signature, this.Data); } } diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccResponseCurveSet16TagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccResponseCurveSet16TagDataEntry.cs index 6d321eb751..494aa2888b 100644 --- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccResponseCurveSet16TagDataEntry.cs +++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccResponseCurveSet16TagDataEntry.cs @@ -83,10 +83,10 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc /// public override int GetHashCode() { - return HashHelpers.Combine( - base.GetHashCode(), - this.ChannelCount.GetHashCode(), - this.Curves.GetHashCode()); + return HashCode.Combine( + this.Signature, + this.ChannelCount, + this.Curves); } } } \ No newline at end of file diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccScreeningTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccScreeningTagDataEntry.cs index d13c2af909..a073291ad1 100644 --- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccScreeningTagDataEntry.cs +++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccScreeningTagDataEntry.cs @@ -77,10 +77,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc /// public override int GetHashCode() { - return HashHelpers.Combine( - base.GetHashCode(), - (int)this.Flags, - this.Channels.GetHashCode()); + return HashCode.Combine(this.Signature, this.Flags, this.Channels); } } } diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccSignatureTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccSignatureTagDataEntry.cs index d89f3ef244..287f0efb0c 100644 --- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccSignatureTagDataEntry.cs +++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccSignatureTagDataEntry.cs @@ -65,9 +65,6 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc } /// - public override int GetHashCode() - { - return HashHelpers.Combine(base.GetHashCode(), this.SignatureData.GetHashCode()); - } + public override int GetHashCode() => HashCode.Combine(this.Signature, this.SignatureData); } } diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccTextDescriptionTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccTextDescriptionTagDataEntry.cs index 9f9e5cef7b..8e6f4bc196 100644 --- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccTextDescriptionTagDataEntry.cs +++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccTextDescriptionTagDataEntry.cs @@ -166,13 +166,13 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc /// public override int GetHashCode() { - int hashCode = base.GetHashCode(); - hashCode = HashHelpers.Combine(hashCode, this.Ascii?.GetHashCode() ?? 0); - hashCode = HashHelpers.Combine(hashCode, this.Unicode?.GetHashCode() ?? 0); - hashCode = HashHelpers.Combine(hashCode, this.ScriptCode?.GetHashCode() ?? 0); - hashCode = HashHelpers.Combine(hashCode, this.UnicodeLanguageCode.GetHashCode()); - hashCode = HashHelpers.Combine(hashCode, this.ScriptCodeCode.GetHashCode()); - return hashCode; + return HashCode.Combine( + this.Signature, + this.Ascii, + this.Unicode, + this.ScriptCode, + this.UnicodeLanguageCode, + this.ScriptCodeCode); } } } \ No newline at end of file diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccTextTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccTextTagDataEntry.cs index 0ff7de5512..ab3b3fb6fb 100644 --- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccTextTagDataEntry.cs +++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccTextTagDataEntry.cs @@ -64,9 +64,6 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc } /// - public override int GetHashCode() - { - return HashHelpers.Combine(base.GetHashCode(), this.Text.GetHashCode()); - } + public override int GetHashCode() => HashCode.Combine(this.Signature, this.Text); } } \ No newline at end of file diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUFix16ArrayTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUFix16ArrayTagDataEntry.cs index 4b03f1b830..464cbb9e75 100644 --- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUFix16ArrayTagDataEntry.cs +++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUFix16ArrayTagDataEntry.cs @@ -64,9 +64,6 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc } /// - public override int GetHashCode() - { - return HashHelpers.Combine(base.GetHashCode(), this.Data.GetHashCode()); - } + public override int GetHashCode() => HashCode.Combine(this.Signature, this.Data); } } \ No newline at end of file diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUInt16ArrayTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUInt16ArrayTagDataEntry.cs index 1536739846..1e7a7f8a90 100644 --- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUInt16ArrayTagDataEntry.cs +++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUInt16ArrayTagDataEntry.cs @@ -64,9 +64,6 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc } /// - public override int GetHashCode() - { - return HashHelpers.Combine(base.GetHashCode(), this.Data.GetHashCode()); - } + public override int GetHashCode() => HashCode.Combine(this.Signature, this.Data); } -} +} \ No newline at end of file diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUInt32ArrayTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUInt32ArrayTagDataEntry.cs index 14ccebb2ab..affdc8720b 100644 --- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUInt32ArrayTagDataEntry.cs +++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUInt32ArrayTagDataEntry.cs @@ -64,9 +64,6 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc } /// - public override int GetHashCode() - { - return HashHelpers.Combine(base.GetHashCode(), this.Data.GetHashCode()); - } + public override int GetHashCode() => HashCode.Combine(this.Signature, this.Data); } } \ No newline at end of file diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUInt64ArrayTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUInt64ArrayTagDataEntry.cs index 1819c7724e..36d48d6135 100644 --- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUInt64ArrayTagDataEntry.cs +++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUInt64ArrayTagDataEntry.cs @@ -65,9 +65,6 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc } /// - public override int GetHashCode() - { - return HashHelpers.Combine(base.GetHashCode(), this.Data.GetHashCode()); - } + public override int GetHashCode() => HashCode.Combine(this.Signature, this.Data); } } \ No newline at end of file diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUInt8ArrayTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUInt8ArrayTagDataEntry.cs index ca4345e2b9..b2f2677575 100644 --- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUInt8ArrayTagDataEntry.cs +++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUInt8ArrayTagDataEntry.cs @@ -64,9 +64,6 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc } /// - public override int GetHashCode() - { - return HashHelpers.Combine(base.GetHashCode(), this.Data.GetHashCode()); - } + public override int GetHashCode() => HashCode.Combine(this.Signature, this.Data); } } \ No newline at end of file diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUcrBgTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUcrBgTagDataEntry.cs index 3992fde109..510930e397 100644 --- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUcrBgTagDataEntry.cs +++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUcrBgTagDataEntry.cs @@ -86,11 +86,11 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc /// public override int GetHashCode() { - return HashHelpers.Combine( - base.GetHashCode(), - this.UcrCurve.GetHashCode(), - this.BgCurve.GetHashCode(), - this.Description.GetHashCode()); + return HashCode.Combine( + this.Signature, + this.UcrCurve, + this.BgCurve, + this.Description); } } } \ No newline at end of file diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUnknownTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUnknownTagDataEntry.cs index f6a4149b46..a0089e7359 100644 --- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUnknownTagDataEntry.cs +++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUnknownTagDataEntry.cs @@ -64,9 +64,6 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc } /// - public override int GetHashCode() - { - return HashHelpers.Combine(base.GetHashCode(), this.Data.GetHashCode()); - } + public override int GetHashCode() => HashCode.Combine(this.Signature, this.Data); } } \ No newline at end of file diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccViewingConditionsTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccViewingConditionsTagDataEntry.cs index 5b12c9d7ec..bd636d4f2c 100644 --- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccViewingConditionsTagDataEntry.cs +++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccViewingConditionsTagDataEntry.cs @@ -86,11 +86,11 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc /// public override int GetHashCode() { - return HashHelpers.Combine( - base.GetHashCode(), - this.IlluminantXyz.GetHashCode(), - this.SurroundXyz.GetHashCode(), - this.Illuminant.GetHashCode()); + return HashCode.Combine( + this.Signature, + this.IlluminantXyz, + this.SurroundXyz, + this.Illuminant); } } } diff --git a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccClut.cs b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccClut.cs index 685b5884fb..3f7cad3afe 100644 --- a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccClut.cs +++ b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccClut.cs @@ -142,12 +142,12 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc /// public override int GetHashCode() { - int hashCode = this.Values.GetHashCode(); - hashCode = HashHelpers.Combine(hashCode, this.DataType.GetHashCode()); - hashCode = HashHelpers.Combine(hashCode, this.InputChannelCount.GetHashCode()); - hashCode = HashHelpers.Combine(hashCode, this.OutputChannelCount.GetHashCode()); - hashCode = HashHelpers.Combine(hashCode, this.GridPointCount.GetHashCode()); - return hashCode; + return HashCode.Combine( + this.Values, + this.DataType, + this.InputChannelCount, + this.OutputChannelCount, + this.GridPointCount); } private bool EqualsValuesArray(IccClut other) diff --git a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccColorantTableEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccColorantTableEntry.cs index 628934600a..8f273dd603 100644 --- a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccColorantTableEntry.cs +++ b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccColorantTableEntry.cs @@ -102,11 +102,11 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc /// public override int GetHashCode() { - return HashHelpers.Combine( - this.Name.GetHashCode(), - this.Pcs1.GetHashCode(), - this.Pcs2.GetHashCode(), - this.Pcs3.GetHashCode()); + return HashCode.Combine( + this.Name, + this.Pcs1, + this.Pcs2, + this.Pcs3); } /// diff --git a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccNamedColor.cs b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccNamedColor.cs index 5889e5c213..b7cb5bc495 100644 --- a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccNamedColor.cs +++ b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccNamedColor.cs @@ -90,10 +90,10 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc /// public override int GetHashCode() { - return HashHelpers.Combine( - this.Name.GetHashCode(), - this.PcsCoordinates.GetHashCode(), - this.DeviceCoordinates.GetHashCode()); + return HashCode.Combine( + this.Name, + this.PcsCoordinates, + this.DeviceCoordinates); } /// diff --git a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccProfileDescription.cs b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccProfileDescription.cs index 3af6dc6a8f..7e7c527ead 100644 --- a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccProfileDescription.cs +++ b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccProfileDescription.cs @@ -84,13 +84,13 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc /// public override int GetHashCode() { - int hashCode = this.DeviceManufacturer.GetHashCode(); - hashCode = HashHelpers.Combine(hashCode, this.DeviceModel.GetHashCode()); - hashCode = HashHelpers.Combine(hashCode, this.DeviceAttributes.GetHashCode()); - hashCode = HashHelpers.Combine(hashCode, this.TechnologyInformation.GetHashCode()); - hashCode = HashHelpers.Combine(hashCode, this.DeviceManufacturerInfo.GetHashCode()); - hashCode = HashHelpers.Combine(hashCode, this.DeviceModelInfo.GetHashCode()); - return hashCode; + return HashCode.Combine( + this.DeviceManufacturer, + this.DeviceModel, + this.DeviceAttributes, + this.TechnologyInformation, + this.DeviceManufacturerInfo, + this.DeviceModelInfo); } } } diff --git a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccProfileId.cs b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccProfileId.cs index 2748e7da72..f64d5409ae 100644 --- a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccProfileId.cs +++ b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccProfileId.cs @@ -101,11 +101,11 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc /// public override int GetHashCode() { - return HashHelpers.Combine( - this.Part1.GetHashCode(), - this.Part2.GetHashCode(), - this.Part3.GetHashCode(), - this.Part4.GetHashCode()); + return HashCode.Combine( + this.Part1, + this.Part2, + this.Part3, + this.Part4); } /// diff --git a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccProfileSequenceIdentifier.cs b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccProfileSequenceIdentifier.cs index 5422a1b5f1..ae451c5db8 100644 --- a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccProfileSequenceIdentifier.cs +++ b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccProfileSequenceIdentifier.cs @@ -44,9 +44,6 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc } /// - public override int GetHashCode() - { - return HashHelpers.Combine(this.Id.GetHashCode(), this.Description.GetHashCode()); - } + public override int GetHashCode() => HashCode.Combine(this.Id, this.Description); } } diff --git a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccResponseNumber.cs b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccResponseNumber.cs index c0bae296d8..8cae869925 100644 --- a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccResponseNumber.cs +++ b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccResponseNumber.cs @@ -73,17 +73,9 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc this.MeasurementValue == other.MeasurementValue; /// - public override int GetHashCode() - { - return HashHelpers.Combine( - this.DeviceCode.GetHashCode(), - this.MeasurementValue.GetHashCode()); - } + public override int GetHashCode() => HashCode.Combine(this.DeviceCode, this.MeasurementValue); /// - public override string ToString() - { - return $"Code: {this.DeviceCode}; Value: {this.MeasurementValue}"; - } + public override string ToString() => $"Code: {this.DeviceCode}; Value: {this.MeasurementValue}"; } } diff --git a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccScreeningChannel.cs b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccScreeningChannel.cs index f2e1f31a5f..e8885a66bf 100644 --- a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccScreeningChannel.cs +++ b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccScreeningChannel.cs @@ -85,10 +85,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc /// public override int GetHashCode() { - return HashHelpers.Combine( - this.Frequency.GetHashCode(), - this.Angle.GetHashCode(), - (int)this.SpotShape); + return HashCode.Combine(this.Frequency, this.Angle, this.SpotShape); } /// diff --git a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccTagTableEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccTagTableEntry.cs index 082ffc6790..d93e068c52 100644 --- a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccTagTableEntry.cs +++ b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccTagTableEntry.cs @@ -76,17 +76,14 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc /// public bool Equals(IccTagTableEntry other) => - this.Signature == other.Signature && - this.Offset == other.Offset && - this.DataSize == other.DataSize; + this.Signature.Equals(other.Signature) && + this.Offset.Equals(other.Offset) && + this.DataSize.Equals(other.DataSize); /// public override int GetHashCode() { - return HashHelpers.Combine( - this.Signature.GetHashCode(), - this.Offset.GetHashCode(), - this.DataSize.GetHashCode()); + return HashCode.Combine(this.Signature, this.Offset, this.DataSize); } /// diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Bgr24.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Bgr24.cs index 6afa33aff8..96ff7da6f6 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Bgr24.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Bgr24.cs @@ -1,6 +1,7 @@ // Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. +using System; using System.Numerics; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; @@ -189,9 +190,6 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public override int GetHashCode() - { - return HashHelpers.Combine(this.R.GetHashCode(), this.B.GetHashCode(), this.G.GetHashCode()); - } + public override int GetHashCode() => HashCode.Combine(this.R, this.B, this.G); } } \ No newline at end of file diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Rgb24.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Rgb24.cs index fe7c299d55..86565731d2 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Rgb24.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Rgb24.cs @@ -1,6 +1,7 @@ // Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. +using System; using System.Numerics; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; @@ -200,10 +201,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public override int GetHashCode() - { - return HashHelpers.Combine(this.R.GetHashCode(), this.B.GetHashCode(), this.G.GetHashCode()); - } + public override int GetHashCode() => HashCode.Combine(this.R, this.B, this.G); /// public override string ToString() => $"Rgb24({this.R}, {this.G}, {this.B})"; diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Rgb48.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Rgb48.cs index 8d06cdbc8f..eda116a46c 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Rgb48.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Rgb48.cs @@ -189,9 +189,6 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public override int GetHashCode() - { - return HashHelpers.Combine(this.R.GetHashCode(), this.G.GetHashCode(), this.B.GetHashCode()); - } + public override int GetHashCode() => HashCode.Combine(this.R, this.G, this.B); } } \ No newline at end of file diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/RgbaVector.cs b/src/ImageSharp/PixelFormats/PixelImplementations/RgbaVector.cs index ff4c69d701..d65a5ade78 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/RgbaVector.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/RgbaVector.cs @@ -197,11 +197,6 @@ namespace SixLabors.ImageSharp.PixelFormats } /// - public override int GetHashCode() - { - int hash = HashHelpers.Combine(this.R.GetHashCode(), this.G.GetHashCode()); - hash = HashHelpers.Combine(hash, this.B.GetHashCode()); - return HashHelpers.Combine(hash, this.A.GetHashCode()); - } + public override int GetHashCode() => HashCode.Combine(this.R, this.G, this.B, this.A); } } \ No newline at end of file diff --git a/src/ImageSharp/Primitives/ValueSize.cs b/src/ImageSharp/Primitives/ValueSize.cs index 8af9ba2e48..e5e086540d 100644 --- a/src/ImageSharp/Primitives/ValueSize.cs +++ b/src/ImageSharp/Primitives/ValueSize.cs @@ -133,9 +133,6 @@ namespace SixLabors.ImageSharp.Primitives } /// - public override int GetHashCode() - { - return HashHelpers.Combine(this.Value.GetHashCode(), this.Type.GetHashCode()); - } + public override int GetHashCode() => HashCode.Combine(this.Value, this.Type); } -} +} \ No newline at end of file diff --git a/src/ImageSharp/Processing/Processors/Dithering/PixelPair.cs b/src/ImageSharp/Processing/Processors/Dithering/PixelPair.cs index b7bea2c746..13660d30ab 100644 --- a/src/ImageSharp/Processing/Processors/Dithering/PixelPair.cs +++ b/src/ImageSharp/Processing/Processors/Dithering/PixelPair.cs @@ -43,7 +43,6 @@ namespace SixLabors.ImageSharp.Processing.Processors.Dithering => obj is PixelPair other && this.First.Equals(other.First) && this.Second.Equals(other.Second); /// - public override int GetHashCode() - => HashHelpers.Combine(this.First.GetHashCode(), this.Second.GetHashCode()); + public override int GetHashCode() => HashCode.Combine(this.First, this.Second); } } \ No newline at end of file