diff --git a/src/ImageSharp/ColorSpaces/CieLab.cs b/src/ImageSharp/ColorSpaces/CieLab.cs
index ea6df86e2..dd01ea5f4 100644
--- a/src/ImageSharp/ColorSpaces/CieLab.cs
+++ b/src/ImageSharp/ColorSpaces/CieLab.cs
@@ -120,10 +120,11 @@ namespace SixLabors.ImageSharp.ColorSpaces
///
public override int GetHashCode()
{
- int hash = this.L.GetHashCode();
- hash = HashHelpers.Combine(hash, this.A.GetHashCode());
- hash = HashHelpers.Combine(hash, this.B.GetHashCode());
- return HashHelpers.Combine(hash, this.WhitePoint.GetHashCode());
+ return HashHelpers.Combine(
+ this.L.GetHashCode(),
+ this.A.GetHashCode(),
+ this.B.GetHashCode(),
+ this.WhitePoint.GetHashCode());
}
///
diff --git a/src/ImageSharp/ColorSpaces/CieLch.cs b/src/ImageSharp/ColorSpaces/CieLch.cs
index f1a7425e9..fffd368fb 100644
--- a/src/ImageSharp/ColorSpaces/CieLch.cs
+++ b/src/ImageSharp/ColorSpaces/CieLch.cs
@@ -122,10 +122,11 @@ namespace SixLabors.ImageSharp.ColorSpaces
///
public override int GetHashCode()
{
- int hash = this.L.GetHashCode();
- hash = HashHelpers.Combine(hash, this.C.GetHashCode());
- hash = HashHelpers.Combine(hash, this.H.GetHashCode());
- return HashHelpers.Combine(hash, this.WhitePoint.GetHashCode());
+ return HashHelpers.Combine(
+ this.L.GetHashCode(),
+ this.C.GetHashCode(),
+ this.H.GetHashCode(),
+ this.WhitePoint.GetHashCode());
}
///
diff --git a/src/ImageSharp/ColorSpaces/CieLchuv.cs b/src/ImageSharp/ColorSpaces/CieLchuv.cs
index 256b5dc0f..829abbf0e 100644
--- a/src/ImageSharp/ColorSpaces/CieLchuv.cs
+++ b/src/ImageSharp/ColorSpaces/CieLchuv.cs
@@ -121,10 +121,11 @@ namespace SixLabors.ImageSharp.ColorSpaces
///
public override int GetHashCode()
{
- int hash = this.L.GetHashCode();
- hash = HashHelpers.Combine(hash, this.C.GetHashCode());
- hash = HashHelpers.Combine(hash, this.H.GetHashCode());
- return HashHelpers.Combine(hash, this.WhitePoint.GetHashCode());
+ return HashHelpers.Combine(
+ this.L.GetHashCode(),
+ this.C.GetHashCode(),
+ this.H.GetHashCode(),
+ this.WhitePoint.GetHashCode());
}
///
diff --git a/src/ImageSharp/ColorSpaces/CieLuv.cs b/src/ImageSharp/ColorSpaces/CieLuv.cs
index 8fe073d6b..b678084c3 100644
--- a/src/ImageSharp/ColorSpaces/CieLuv.cs
+++ b/src/ImageSharp/ColorSpaces/CieLuv.cs
@@ -121,10 +121,11 @@ namespace SixLabors.ImageSharp.ColorSpaces
///
public override int GetHashCode()
{
- int hash = this.L.GetHashCode();
- hash = HashHelpers.Combine(hash, this.U.GetHashCode());
- hash = HashHelpers.Combine(hash, this.V.GetHashCode());
- return HashHelpers.Combine(hash, this.WhitePoint.GetHashCode());
+ return HashHelpers.Combine(
+ this.L.GetHashCode(),
+ this.U.GetHashCode(),
+ this.V.GetHashCode(),
+ this.WhitePoint.GetHashCode());
}
///
diff --git a/src/ImageSharp/ColorSpaces/CieXyy.cs b/src/ImageSharp/ColorSpaces/CieXyy.cs
index 7137360e9..1d5d2de53 100644
--- a/src/ImageSharp/ColorSpaces/CieXyy.cs
+++ b/src/ImageSharp/ColorSpaces/CieXyy.cs
@@ -85,9 +85,10 @@ namespace SixLabors.ImageSharp.ColorSpaces
///
public override int GetHashCode()
{
- int hash = this.X.GetHashCode();
- hash = HashHelpers.Combine(hash, this.Y.GetHashCode());
- return HashHelpers.Combine(hash, this.Yl.GetHashCode());
+ return HashHelpers.Combine(
+ this.X.GetHashCode(),
+ this.Y.GetHashCode(),
+ this.Yl.GetHashCode());
}
///
diff --git a/src/ImageSharp/ColorSpaces/CieXyz.cs b/src/ImageSharp/ColorSpaces/CieXyz.cs
index c0ed35660..6c9ea65e6 100644
--- a/src/ImageSharp/ColorSpaces/CieXyz.cs
+++ b/src/ImageSharp/ColorSpaces/CieXyz.cs
@@ -88,9 +88,10 @@ namespace SixLabors.ImageSharp.ColorSpaces
///
public override int GetHashCode()
{
- int hash = this.X.GetHashCode();
- hash = HashHelpers.Combine(hash, this.Y.GetHashCode());
- return HashHelpers.Combine(hash, this.Z.GetHashCode());
+ return HashHelpers.Combine(
+ this.X.GetHashCode(),
+ this.Y.GetHashCode(),
+ this.Z.GetHashCode());
}
///
diff --git a/src/ImageSharp/ColorSpaces/Cmyk.cs b/src/ImageSharp/ColorSpaces/Cmyk.cs
index 634667c0c..241a8b325 100644
--- a/src/ImageSharp/ColorSpaces/Cmyk.cs
+++ b/src/ImageSharp/ColorSpaces/Cmyk.cs
@@ -92,10 +92,11 @@ namespace SixLabors.ImageSharp.ColorSpaces
[MethodImpl(InliningOptions.ShortMethod)]
public override int GetHashCode()
{
- int hash = this.C.GetHashCode();
- hash = HashHelpers.Combine(hash, this.M.GetHashCode());
- hash = HashHelpers.Combine(hash, this.Y.GetHashCode());
- return HashHelpers.Combine(hash, this.K.GetHashCode());
+ return HashHelpers.Combine(
+ this.C.GetHashCode(),
+ this.M.GetHashCode(),
+ this.Y.GetHashCode(),
+ this.K.GetHashCode());
}
///
diff --git a/src/ImageSharp/ColorSpaces/Conversion/Implementation/RGBPrimariesChromaticityCoordinates.cs b/src/ImageSharp/ColorSpaces/Conversion/Implementation/RGBPrimariesChromaticityCoordinates.cs
index 68b4d95fc..ba6da5a85 100644
--- a/src/ImageSharp/ColorSpaces/Conversion/Implementation/RGBPrimariesChromaticityCoordinates.cs
+++ b/src/ImageSharp/ColorSpaces/Conversion/Implementation/RGBPrimariesChromaticityCoordinates.cs
@@ -88,12 +88,7 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion.Implementation
///
public override int GetHashCode()
{
- unchecked
- {
- int hashCode = this.R.GetHashCode();
- hashCode = (hashCode * 397) ^ this.G.GetHashCode();
- return (hashCode * 397) ^ this.B.GetHashCode();
- }
+ return HashHelpers.Combine(this.R.GetHashCode(), this.G.GetHashCode(), this.B.GetHashCode());
}
}
}
\ 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 73aa60b6c..271278ad7 100644
--- a/src/ImageSharp/ColorSpaces/Conversion/Implementation/WorkingSpaces/GammaWorkingSpace.cs
+++ b/src/ImageSharp/ColorSpaces/Conversion/Implementation/WorkingSpaces/GammaWorkingSpace.cs
@@ -57,10 +57,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion.Implementation
}
///
- public override int GetHashCode()
- {
- int hash = base.GetHashCode();
- return HashHelpers.Combine(hash, this.Gamma.GetHashCode());
- }
+ public override int GetHashCode() => HashHelpers.Combine(base.GetHashCode(), this.Gamma.GetHashCode());
}
}
\ 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 5a89321c8..70d3ccced 100644
--- a/src/ImageSharp/ColorSpaces/Conversion/Implementation/WorkingSpaces/RgbWorkingSpaceBase.cs
+++ b/src/ImageSharp/ColorSpaces/Conversion/Implementation/WorkingSpaces/RgbWorkingSpaceBase.cs
@@ -76,8 +76,7 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion.Implementation
///
public override int GetHashCode()
{
- int hash = this.WhitePoint.GetHashCode();
- return HashHelpers.Combine(hash, this.ChromaticityCoordinates.GetHashCode());
+ return HashHelpers.Combine(this.WhitePoint.GetHashCode(), this.ChromaticityCoordinates.GetHashCode());
}
}
}
\ No newline at end of file
diff --git a/src/ImageSharp/ColorSpaces/Hsl.cs b/src/ImageSharp/ColorSpaces/Hsl.cs
index f6e531df3..1b92d5e88 100644
--- a/src/ImageSharp/ColorSpaces/Hsl.cs
+++ b/src/ImageSharp/ColorSpaces/Hsl.cs
@@ -86,9 +86,10 @@ namespace SixLabors.ImageSharp.ColorSpaces
[MethodImpl(InliningOptions.ShortMethod)]
public override int GetHashCode()
{
- int hash = this.H.GetHashCode();
- hash = HashHelpers.Combine(hash, this.S.GetHashCode());
- return HashHelpers.Combine(hash, this.L.GetHashCode());
+ return HashHelpers.Combine(
+ this.H.GetHashCode(),
+ this.S.GetHashCode(),
+ this.L.GetHashCode());
}
///
diff --git a/src/ImageSharp/ColorSpaces/Hsv.cs b/src/ImageSharp/ColorSpaces/Hsv.cs
index 631f03d09..56d798af0 100644
--- a/src/ImageSharp/ColorSpaces/Hsv.cs
+++ b/src/ImageSharp/ColorSpaces/Hsv.cs
@@ -84,9 +84,10 @@ namespace SixLabors.ImageSharp.ColorSpaces
[MethodImpl(InliningOptions.ShortMethod)]
public override int GetHashCode()
{
- int hash = this.H.GetHashCode();
- hash = HashHelpers.Combine(hash, this.S.GetHashCode());
- return HashHelpers.Combine(hash, this.V.GetHashCode());
+ return HashHelpers.Combine(
+ this.H.GetHashCode(),
+ this.S.GetHashCode(),
+ this.V.GetHashCode());
}
///
diff --git a/src/ImageSharp/ColorSpaces/HunterLab.cs b/src/ImageSharp/ColorSpaces/HunterLab.cs
index f4fa29d31..1aa7be601 100644
--- a/src/ImageSharp/ColorSpaces/HunterLab.cs
+++ b/src/ImageSharp/ColorSpaces/HunterLab.cs
@@ -119,10 +119,11 @@ namespace SixLabors.ImageSharp.ColorSpaces
[MethodImpl(InliningOptions.ShortMethod)]
public override int GetHashCode()
{
- int hash = this.L.GetHashCode();
- hash = HashHelpers.Combine(hash, this.A.GetHashCode());
- hash = HashHelpers.Combine(hash, this.B.GetHashCode());
- return HashHelpers.Combine(hash, this.WhitePoint.GetHashCode());
+ return HashHelpers.Combine(
+ this.L.GetHashCode(),
+ this.A.GetHashCode(),
+ this.B.GetHashCode(),
+ this.WhitePoint.GetHashCode());
}
///
diff --git a/src/ImageSharp/ColorSpaces/LinearRgb.cs b/src/ImageSharp/ColorSpaces/LinearRgb.cs
index ec6d18be2..fba27a41e 100644
--- a/src/ImageSharp/ColorSpaces/LinearRgb.cs
+++ b/src/ImageSharp/ColorSpaces/LinearRgb.cs
@@ -128,9 +128,10 @@ namespace SixLabors.ImageSharp.ColorSpaces
[MethodImpl(InliningOptions.ShortMethod)]
public override int GetHashCode()
{
- int hash = this.R.GetHashCode();
- hash = HashHelpers.Combine(hash, this.G.GetHashCode());
- return HashHelpers.Combine(hash, this.B.GetHashCode());
+ return HashHelpers.Combine(
+ this.R.GetHashCode(),
+ this.G.GetHashCode(),
+ this.B.GetHashCode());
}
///
diff --git a/src/ImageSharp/ColorSpaces/Lms.cs b/src/ImageSharp/ColorSpaces/Lms.cs
index 0a8b7aa7b..0177c9712 100644
--- a/src/ImageSharp/ColorSpaces/Lms.cs
+++ b/src/ImageSharp/ColorSpaces/Lms.cs
@@ -89,9 +89,10 @@ namespace SixLabors.ImageSharp.ColorSpaces
///
public override int GetHashCode()
{
- int hash = this.L.GetHashCode();
- hash = HashHelpers.Combine(hash, this.M.GetHashCode());
- return HashHelpers.Combine(hash, this.S.GetHashCode());
+ return HashHelpers.Combine(
+ this.L.GetHashCode(),
+ this.M.GetHashCode(),
+ this.S.GetHashCode());
}
///
diff --git a/src/ImageSharp/ColorSpaces/Rgb.cs b/src/ImageSharp/ColorSpaces/Rgb.cs
index 97fafbaf3..ef44d217e 100644
--- a/src/ImageSharp/ColorSpaces/Rgb.cs
+++ b/src/ImageSharp/ColorSpaces/Rgb.cs
@@ -149,9 +149,10 @@ namespace SixLabors.ImageSharp.ColorSpaces
///
public override int GetHashCode()
{
- int hash = this.R.GetHashCode();
- hash = HashHelpers.Combine(hash, this.G.GetHashCode());
- return HashHelpers.Combine(hash, this.B.GetHashCode());
+ return HashHelpers.Combine(
+ this.R.GetHashCode(),
+ this.G.GetHashCode(),
+ this.B.GetHashCode());
}
///
diff --git a/src/ImageSharp/ColorSpaces/YCbCr.cs b/src/ImageSharp/ColorSpaces/YCbCr.cs
index 6aa191c2d..2287d3689 100644
--- a/src/ImageSharp/ColorSpaces/YCbCr.cs
+++ b/src/ImageSharp/ColorSpaces/YCbCr.cs
@@ -85,9 +85,10 @@ namespace SixLabors.ImageSharp.ColorSpaces
[MethodImpl(InliningOptions.ShortMethod)]
public override int GetHashCode()
{
- int hash = this.Y.GetHashCode();
- hash = HashHelpers.Combine(hash, this.Cb.GetHashCode());
- return HashHelpers.Combine(hash, this.Cr.GetHashCode());
+ return HashHelpers.Combine(
+ this.Y.GetHashCode(),
+ this.Cb.GetHashCode(),
+ this.Cr.GetHashCode());
}
///
diff --git a/src/ImageSharp/Formats/Jpeg/Components/Decoder/AdobeMarker.cs b/src/ImageSharp/Formats/Jpeg/Components/Decoder/AdobeMarker.cs
index af0938d30..1fa09605e 100644
--- a/src/ImageSharp/Formats/Jpeg/Components/Decoder/AdobeMarker.cs
+++ b/src/ImageSharp/Formats/Jpeg/Components/Decoder/AdobeMarker.cs
@@ -102,11 +102,9 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder
{
return HashHelpers.Combine(
this.DCTEncodeVersion.GetHashCode(),
- HashHelpers.Combine(
- this.APP14Flags0.GetHashCode(),
- HashHelpers.Combine(
- this.APP14Flags1.GetHashCode(),
- this.ColorTransform.GetHashCode())));
+ this.APP14Flags0.GetHashCode(),
+ this.APP14Flags1.GetHashCode(),
+ this.ColorTransform.GetHashCode());
}
}
}
\ No newline at end of file
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/Curves/IccResponseCurve.cs b/src/ImageSharp/MetaData/Profiles/ICC/Curves/IccResponseCurve.cs
index 02ab301bd..16b0ddbef 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/Curves/IccResponseCurve.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/Curves/IccResponseCurve.cs
@@ -73,13 +73,10 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override int GetHashCode()
{
- unchecked
- {
- int hashCode = (int)this.CurveType;
- hashCode = (hashCode * 397) ^ (this.XyzValues?.GetHashCode() ?? 0);
- hashCode = (hashCode * 397) ^ (this.ResponseArrays?.GetHashCode() ?? 0);
- return hashCode;
- }
+ return HashHelpers.Combine(
+ (int)this.CurveType,
+ this.XyzValues.GetHashCode(),
+ this.ResponseArrays.GetHashCode());
}
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 a87dae8c5..0a27ce2d5 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccChromaticityTagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccChromaticityTagDataEntry.cs
@@ -110,13 +110,10 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override int GetHashCode()
{
- unchecked
- {
- int hashCode = base.GetHashCode();
- hashCode = (hashCode * 397) ^ (int)this.ColorantType;
- hashCode = (hashCode * 397) ^ (this.ChannelValues?.GetHashCode() ?? 0);
- return hashCode;
- }
+ return HashHelpers.Combine(
+ base.GetHashCode(),
+ (int)this.ColorantType,
+ this.ChannelValues.GetHashCode());
}
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 54c205615..5b8526b7d 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccColorantOrderTagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccColorantOrderTagDataEntry.cs
@@ -70,10 +70,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override int GetHashCode()
{
- unchecked
- {
- return (base.GetHashCode() * 397) ^ (this.ColorantNumber?.GetHashCode() ?? 0);
- }
+ return HashHelpers.Combine(base.GetHashCode(), this.ColorantNumber.GetHashCode());
}
}
}
\ 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 dd99a2f9f..572df8cb8 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccColorantTableTagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccColorantTableTagDataEntry.cs
@@ -72,10 +72,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override int GetHashCode()
{
- unchecked
- {
- return (base.GetHashCode() * 397) ^ (this.ColorantData?.GetHashCode() ?? 0);
- }
+ return HashHelpers.Combine(base.GetHashCode(), this.ColorantData.GetHashCode());
}
}
}
\ No newline at end of file
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccCurveTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccCurveTagDataEntry.cs
index 77a913b14..2884a2216 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccCurveTagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccCurveTagDataEntry.cs
@@ -118,10 +118,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override int GetHashCode()
{
- unchecked
- {
- return (base.GetHashCode() * 397) ^ (this.CurveData?.GetHashCode() ?? 0);
- }
+ return HashHelpers.Combine(base.GetHashCode(), this.CurveData.GetHashCode());
}
}
}
\ 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 451088290..9567c690c 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccDataTagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccDataTagDataEntry.cs
@@ -91,13 +91,10 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override int GetHashCode()
{
- unchecked
- {
- int hashCode = base.GetHashCode();
- hashCode = (hashCode * 397) ^ (this.Data?.GetHashCode() ?? 0);
- hashCode = (hashCode * 397) ^ this.IsAscii.GetHashCode();
- return hashCode;
- }
+ return HashHelpers.Combine(
+ base.GetHashCode(),
+ this.Data.GetHashCode(),
+ this.IsAscii.GetHashCode());
}
}
}
\ 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 792c653f6..12479bb61 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccDateTimeTagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccDateTimeTagDataEntry.cs
@@ -66,10 +66,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override int GetHashCode()
{
- unchecked
- {
- return (base.GetHashCode() * 397) ^ this.Value.GetHashCode();
- }
+ return HashHelpers.Combine(base.GetHashCode(), this.Value.GetHashCode());
}
}
}
\ 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 a76310927..3b9cce86b 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccFix16ArrayTagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccFix16ArrayTagDataEntry.cs
@@ -66,10 +66,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override int GetHashCode()
{
- unchecked
- {
- return (base.GetHashCode() * 397) ^ (this.Data?.GetHashCode() ?? 0);
- }
+ return HashHelpers.Combine(base.GetHashCode(), this.Data.GetHashCode());
}
}
}
\ 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 9a7f2123e..e11562f44 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLut16TagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLut16TagDataEntry.cs
@@ -62,17 +62,14 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
: base(IccTypeSignature.Lut16, tagSignature)
{
Guard.NotNull(matrix, nameof(matrix));
- Guard.NotNull(inputValues, nameof(inputValues));
- Guard.NotNull(clutValues, nameof(clutValues));
- Guard.NotNull(outputValues, nameof(outputValues));
bool is3By3 = matrix.GetLength(0) == 3 && matrix.GetLength(1) == 3;
Guard.IsTrue(is3By3, nameof(matrix), "Matrix must have a size of three by three");
this.Matrix = this.CreateMatrix(matrix);
- this.InputValues = inputValues;
- this.ClutValues = clutValues;
- this.OutputValues = outputValues;
+ this.InputValues = inputValues ?? throw new ArgumentNullException(nameof(inputValues));
+ this.ClutValues = clutValues ?? throw new ArgumentNullException(nameof(clutValues));
+ this.OutputValues = outputValues ?? throw new ArgumentNullException(nameof(outputValues));
Guard.IsTrue(this.InputChannelCount == clutValues.InputChannelCount, nameof(clutValues), "Input channel count does not match the CLUT size");
Guard.IsTrue(this.OutputChannelCount == clutValues.OutputChannelCount, nameof(clutValues), "Output channel count does not match the CLUT size");
@@ -147,9 +144,9 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
{
int hashCode = base.GetHashCode();
hashCode = (hashCode * 397) ^ this.Matrix.GetHashCode();
- hashCode = (hashCode * 397) ^ (this.InputValues?.GetHashCode() ?? 0);
- hashCode = (hashCode * 397) ^ (this.ClutValues?.GetHashCode() ?? 0);
- hashCode = (hashCode * 397) ^ (this.OutputValues?.GetHashCode() ?? 0);
+ hashCode = (hashCode * 397) ^ this.InputValues.GetHashCode();
+ hashCode = (hashCode * 397) ^ this.ClutValues.GetHashCode();
+ hashCode = (hashCode * 397) ^ this.OutputValues.GetHashCode();
return hashCode;
}
}
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLut8TagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLut8TagDataEntry.cs
index bc0335cd8..b448b481a 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLut8TagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLut8TagDataEntry.cs
@@ -62,17 +62,14 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
: base(IccTypeSignature.Lut8, tagSignature)
{
Guard.NotNull(matrix, nameof(matrix));
- Guard.NotNull(inputValues, nameof(inputValues));
- Guard.NotNull(clutValues, nameof(clutValues));
- Guard.NotNull(outputValues, nameof(outputValues));
bool is3By3 = matrix.GetLength(0) == 3 && matrix.GetLength(1) == 3;
Guard.IsTrue(is3By3, nameof(matrix), "Matrix must have a size of three by three");
this.Matrix = this.CreateMatrix(matrix);
- this.InputValues = inputValues;
- this.ClutValues = clutValues;
- this.OutputValues = outputValues;
+ this.InputValues = inputValues ?? throw new ArgumentNullException(nameof(inputValues));
+ this.ClutValues = clutValues ?? throw new ArgumentNullException(nameof(clutValues));
+ this.OutputValues = outputValues ?? throw new ArgumentNullException(nameof(outputValues));
Guard.IsTrue(this.InputChannelCount == clutValues.InputChannelCount, nameof(clutValues), "Input channel count does not match the CLUT size");
Guard.IsTrue(this.OutputChannelCount == clutValues.OutputChannelCount, nameof(clutValues), "Output channel count does not match the CLUT size");
@@ -150,9 +147,9 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
{
int hashCode = base.GetHashCode();
hashCode = (hashCode * 397) ^ this.Matrix.GetHashCode();
- hashCode = (hashCode * 397) ^ (this.InputValues?.GetHashCode() ?? 0);
- hashCode = (hashCode * 397) ^ (this.ClutValues?.GetHashCode() ?? 0);
- hashCode = (hashCode * 397) ^ (this.OutputValues?.GetHashCode() ?? 0);
+ hashCode = (hashCode * 397) ^ this.InputValues.GetHashCode();
+ hashCode = (hashCode * 397) ^ this.ClutValues.GetHashCode();
+ hashCode = (hashCode * 397) ^ this.OutputValues.GetHashCode();
return hashCode;
}
}
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccMultiLocalizedUnicodeTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccMultiLocalizedUnicodeTagDataEntry.cs
index 48ed048bf..6f579a6b5 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccMultiLocalizedUnicodeTagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccMultiLocalizedUnicodeTagDataEntry.cs
@@ -68,10 +68,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override int GetHashCode()
{
- unchecked
- {
- return (base.GetHashCode() * 397) ^ (this.Texts?.GetHashCode() ?? 0);
- }
+ return HashHelpers.Combine(base.GetHashCode(), this.Texts.GetHashCode());
}
}
}
\ 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 1429a0a87..2a983a709 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccMultiProcessElementsTagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccMultiProcessElementsTagDataEntry.cs
@@ -90,14 +90,11 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override int GetHashCode()
{
- unchecked
- {
- int hashCode = base.GetHashCode();
- hashCode = (hashCode * 397) ^ this.InputChannelCount;
- hashCode = (hashCode * 397) ^ this.OutputChannelCount;
- hashCode = (hashCode * 397) ^ (this.Data?.GetHashCode() ?? 0);
- return hashCode;
- }
+ return HashHelpers.Combine(
+ base.GetHashCode(),
+ this.InputChannelCount,
+ this.OutputChannelCount,
+ this.Data.GetHashCode());
}
}
}
\ No newline at end of file
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccParametricCurveTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccParametricCurveTagDataEntry.cs
index 46719b80f..384129245 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccParametricCurveTagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccParametricCurveTagDataEntry.cs
@@ -28,7 +28,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
public IccParametricCurveTagDataEntry(IccParametricCurve curve, IccProfileTag tagSignature)
: base(IccTypeSignature.ParametricCurve, tagSignature)
{
- this.Curve = curve;
+ this.Curve = curve ?? throw new ArgumentNullException(nameof(curve));
}
///
@@ -67,10 +67,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override int GetHashCode()
{
- unchecked
- {
- return (base.GetHashCode() * 397) ^ (this.Curve?.GetHashCode() ?? 0);
- }
+ return HashHelpers.Combine(base.GetHashCode(), this.Curve.GetHashCode());
}
}
}
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccProfileSequenceDescTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccProfileSequenceDescTagDataEntry.cs
index da6fcd7a2..a337d76ef 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccProfileSequenceDescTagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccProfileSequenceDescTagDataEntry.cs
@@ -69,10 +69,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override int GetHashCode()
{
- unchecked
- {
- return (base.GetHashCode() * 397) ^ (this.Descriptions?.GetHashCode() ?? 0);
- }
+ return HashHelpers.Combine(base.GetHashCode(), this.Descriptions.GetHashCode());
}
}
}
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccProfileSequenceIdentifierTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccProfileSequenceIdentifierTagDataEntry.cs
index 51528a073..9c199bfdb 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccProfileSequenceIdentifierTagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccProfileSequenceIdentifierTagDataEntry.cs
@@ -67,10 +67,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override int GetHashCode()
{
- unchecked
- {
- return (base.GetHashCode() * 397) ^ (this.Data?.GetHashCode() ?? 0);
- }
+ return HashHelpers.Combine(base.GetHashCode(), this.Data.GetHashCode());
}
}
}
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccResponseCurveSet16TagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccResponseCurveSet16TagDataEntry.cs
index e2cd5860b..6d321eb75 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccResponseCurveSet16TagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccResponseCurveSet16TagDataEntry.cs
@@ -83,13 +83,10 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override int GetHashCode()
{
- unchecked
- {
- int hashCode = base.GetHashCode();
- hashCode = (hashCode * 397) ^ this.ChannelCount.GetHashCode();
- hashCode = (hashCode * 397) ^ (this.Curves?.GetHashCode() ?? 0);
- return hashCode;
- }
+ return HashHelpers.Combine(
+ base.GetHashCode(),
+ this.ChannelCount.GetHashCode(),
+ this.Curves.GetHashCode());
}
}
}
\ 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 0bf8abfca..d13c2af90 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccScreeningTagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccScreeningTagDataEntry.cs
@@ -77,13 +77,10 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override int GetHashCode()
{
- unchecked
- {
- int hashCode = base.GetHashCode();
- hashCode = (hashCode * 397) ^ (int)this.Flags;
- hashCode = (hashCode * 397) ^ (this.Channels?.GetHashCode() ?? 0);
- return hashCode;
- }
+ return HashHelpers.Combine(
+ base.GetHashCode(),
+ (int)this.Flags,
+ this.Channels.GetHashCode());
}
}
}
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccSignatureTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccSignatureTagDataEntry.cs
index da557e644..d89f3ef24 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccSignatureTagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccSignatureTagDataEntry.cs
@@ -67,10 +67,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override int GetHashCode()
{
- unchecked
- {
- return (base.GetHashCode() * 397) ^ (this.SignatureData?.GetHashCode() ?? 0);
- }
+ return HashHelpers.Combine(base.GetHashCode(), this.SignatureData.GetHashCode());
}
}
}
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccTextTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccTextTagDataEntry.cs
index f10712d96..0ff7de551 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccTextTagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccTextTagDataEntry.cs
@@ -66,10 +66,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override int GetHashCode()
{
- unchecked
- {
- return (base.GetHashCode() * 397) ^ (this.Text?.GetHashCode() ?? 0);
- }
+ return HashHelpers.Combine(base.GetHashCode(), this.Text.GetHashCode());
}
}
}
\ 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 19430dc7b..4b03f1b83 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUFix16ArrayTagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUFix16ArrayTagDataEntry.cs
@@ -66,10 +66,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override int GetHashCode()
{
- unchecked
- {
- return (base.GetHashCode() * 397) ^ (this.Data?.GetHashCode() ?? 0);
- }
+ return HashHelpers.Combine(base.GetHashCode(), this.Data.GetHashCode());
}
}
}
\ 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 d9c093bda..153673984 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUInt16ArrayTagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUInt16ArrayTagDataEntry.cs
@@ -66,10 +66,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override int GetHashCode()
{
- unchecked
- {
- return (base.GetHashCode() * 397) ^ (this.Data?.GetHashCode() ?? 0);
- }
+ return HashHelpers.Combine(base.GetHashCode(), this.Data.GetHashCode());
}
}
}
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUInt32ArrayTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUInt32ArrayTagDataEntry.cs
index 803191929..14ccebb2a 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUInt32ArrayTagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUInt32ArrayTagDataEntry.cs
@@ -66,10 +66,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override int GetHashCode()
{
- unchecked
- {
- return (base.GetHashCode() * 397) ^ (this.Data?.GetHashCode() ?? 0);
- }
+ return HashHelpers.Combine(base.GetHashCode(), this.Data.GetHashCode());
}
}
}
\ 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 2973b9ae6..1819c7724 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUInt64ArrayTagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUInt64ArrayTagDataEntry.cs
@@ -67,10 +67,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override int GetHashCode()
{
- unchecked
- {
- return (base.GetHashCode() * 397) ^ (this.Data?.GetHashCode() ?? 0);
- }
+ return HashHelpers.Combine(base.GetHashCode(), this.Data.GetHashCode());
}
}
}
\ 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 2391ce96a..ca4345e2b 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUInt8ArrayTagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUInt8ArrayTagDataEntry.cs
@@ -66,10 +66,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override int GetHashCode()
{
- unchecked
- {
- return (base.GetHashCode() * 397) ^ (this.Data?.GetHashCode() ?? 0);
- }
+ return HashHelpers.Combine(base.GetHashCode(), this.Data.GetHashCode());
}
}
}
\ 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 eed4f97d4..3992fde10 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUcrBgTagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUcrBgTagDataEntry.cs
@@ -86,14 +86,11 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override int GetHashCode()
{
- unchecked
- {
- int hashCode = base.GetHashCode();
- hashCode = (hashCode * 397) ^ (this.UcrCurve?.GetHashCode() ?? 0);
- hashCode = (hashCode * 397) ^ (this.BgCurve?.GetHashCode() ?? 0);
- hashCode = (hashCode * 397) ^ (this.Description?.GetHashCode() ?? 0);
- return hashCode;
- }
+ return HashHelpers.Combine(
+ base.GetHashCode(),
+ this.UcrCurve.GetHashCode(),
+ this.BgCurve.GetHashCode(),
+ this.Description.GetHashCode());
}
}
}
\ 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 da206a968..f6a4149b4 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUnknownTagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUnknownTagDataEntry.cs
@@ -66,10 +66,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override int GetHashCode()
{
- unchecked
- {
- return (base.GetHashCode() * 397) ^ (this.Data?.GetHashCode() ?? 0);
- }
+ return HashHelpers.Combine(base.GetHashCode(), this.Data.GetHashCode());
}
}
}
\ 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 6be21dcc9..df53957b1 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccViewingConditionsTagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccViewingConditionsTagDataEntry.cs
@@ -86,14 +86,11 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override int GetHashCode()
{
- unchecked
- {
- int hashCode = base.GetHashCode();
- hashCode = (hashCode * 397) ^ this.IlluminantXyz.GetHashCode();
- hashCode = (hashCode * 397) ^ this.SurroundXyz.GetHashCode();
- hashCode = (hashCode * 397) ^ (int)this.Illuminant;
- return hashCode;
- }
+ return HashHelpers.Combine(
+ base.GetHashCode(),
+ this.IlluminantXyz.GetHashCode(),
+ this.SurroundXyz.GetHashCode(),
+ (int)this.Illuminant);
}
}
}
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccClut.cs b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccClut.cs
index 4878d96e4..3424a11ed 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccClut.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccClut.cs
@@ -144,11 +144,11 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
{
unchecked
{
- int hashCode = this.Values?.GetHashCode() ?? 0;
+ int hashCode = this.Values.GetHashCode();
hashCode = (hashCode * 397) ^ (int)this.DataType;
hashCode = (hashCode * 397) ^ this.InputChannelCount;
hashCode = (hashCode * 397) ^ this.OutputChannelCount;
- hashCode = (hashCode * 397) ^ (this.GridPointCount?.GetHashCode() ?? 0);
+ hashCode = (hashCode * 397) ^ this.GridPointCount.GetHashCode();
return hashCode;
}
}
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccColorantTableEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccColorantTableEntry.cs
index 56aa8b335..628934600 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccColorantTableEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccColorantTableEntry.cs
@@ -102,14 +102,11 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override int GetHashCode()
{
- unchecked
- {
- int hashCode = this.Name.GetHashCode();
- hashCode = (hashCode * 397) ^ this.Pcs1.GetHashCode();
- hashCode = (hashCode * 397) ^ this.Pcs2.GetHashCode();
- hashCode = (hashCode * 397) ^ this.Pcs3.GetHashCode();
- return hashCode;
- }
+ return HashHelpers.Combine(
+ this.Name.GetHashCode(),
+ this.Pcs1.GetHashCode(),
+ this.Pcs2.GetHashCode(),
+ this.Pcs3.GetHashCode());
}
///
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccNamedColor.cs b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccNamedColor.cs
index 5b013fc2c..5889e5c21 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccNamedColor.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccNamedColor.cs
@@ -80,27 +80,23 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
}
///
- public bool Equals(IccNamedColor other) =>
- this.Name == other.Name &&
- this.PcsCoordinates.SequenceEqual(other.PcsCoordinates) &&
- this.DeviceCoordinates.SequenceEqual(other.DeviceCoordinates);
+ public bool Equals(IccNamedColor other)
+ {
+ return this.Name.Equals(other.Name)
+ && this.PcsCoordinates.SequenceEqual(other.PcsCoordinates)
+ && this.DeviceCoordinates.SequenceEqual(other.DeviceCoordinates);
+ }
///
public override int GetHashCode()
{
- unchecked
- {
- int hashCode = this.Name.GetHashCode();
- hashCode = (hashCode * 397) ^ this.PcsCoordinates.GetHashCode();
- hashCode = (hashCode * 397) ^ this.DeviceCoordinates.GetHashCode();
- return hashCode;
- }
+ return HashHelpers.Combine(
+ this.Name.GetHashCode(),
+ this.PcsCoordinates.GetHashCode(),
+ this.DeviceCoordinates.GetHashCode());
}
///
- public override string ToString()
- {
- return this.Name;
- }
+ public override string ToString() => this.Name;
}
}
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccPositionNumber.cs b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccPositionNumber.cs
index aad130b0d..745312f56 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccPositionNumber.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccPositionNumber.cs
@@ -73,15 +73,9 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
this.Size == other.Size;
///
- public override int GetHashCode()
- {
- return unchecked((int)(this.Offset ^ this.Size));
- }
+ public override int GetHashCode() => unchecked((int)(this.Offset ^ this.Size));
///
- public override string ToString()
- {
- return $"{this.Offset}; {this.Size}";
- }
+ public override string ToString() => $"{this.Offset}; {this.Size}";
}
}
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccProfileDescription.cs b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccProfileDescription.cs
index 9db4bb9c4..4319b0e8b 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccProfileDescription.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccProfileDescription.cs
@@ -28,15 +28,12 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
IccLocalizedString[] deviceManufacturerInfo,
IccLocalizedString[] deviceModelInfo)
{
- Guard.NotNull(deviceManufacturerInfo, nameof(deviceManufacturerInfo));
- Guard.NotNull(deviceModelInfo, nameof(deviceModelInfo));
-
this.DeviceManufacturer = deviceManufacturer;
this.DeviceModel = deviceModel;
this.DeviceAttributes = deviceAttributes;
this.TechnologyInformation = technologyInformation;
- this.DeviceManufacturerInfo = deviceManufacturerInfo;
- this.DeviceModelInfo = deviceModelInfo;
+ this.DeviceManufacturerInfo = deviceManufacturerInfo ?? throw new ArgumentNullException(nameof(deviceManufacturerInfo));
+ this.DeviceModelInfo = deviceModelInfo ?? throw new ArgumentNullException(nameof(deviceModelInfo));
}
///
@@ -93,8 +90,8 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
hashCode = (hashCode * 397) ^ (int)this.DeviceModel;
hashCode = (hashCode * 397) ^ this.DeviceAttributes.GetHashCode();
hashCode = (hashCode * 397) ^ (int)this.TechnologyInformation;
- hashCode = (hashCode * 397) ^ (this.DeviceManufacturerInfo?.GetHashCode() ?? 0);
- hashCode = (hashCode * 397) ^ (this.DeviceModelInfo?.GetHashCode() ?? 0);
+ hashCode = (hashCode * 397) ^ this.DeviceManufacturerInfo.GetHashCode();
+ hashCode = (hashCode * 397) ^ this.DeviceModelInfo.GetHashCode();
return hashCode;
}
}
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccProfileId.cs b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccProfileId.cs
index 138999710..2748e7da7 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccProfileId.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccProfileId.cs
@@ -101,14 +101,11 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override int GetHashCode()
{
- unchecked
- {
- int hashCode = this.Part1.GetHashCode();
- hashCode = (hashCode * 397) ^ this.Part2.GetHashCode();
- hashCode = (hashCode * 397) ^ this.Part3.GetHashCode();
- hashCode = (hashCode * 397) ^ this.Part4.GetHashCode();
- return hashCode;
- }
+ return HashHelpers.Combine(
+ this.Part1.GetHashCode(),
+ this.Part2.GetHashCode(),
+ this.Part3.GetHashCode(),
+ this.Part4.GetHashCode());
}
///
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccProfileSequenceIdentifier.cs b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccProfileSequenceIdentifier.cs
index d5362ad70..5422a1b5f 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccProfileSequenceIdentifier.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccProfileSequenceIdentifier.cs
@@ -18,10 +18,8 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
/// Description of the profile
public IccProfileSequenceIdentifier(IccProfileId id, IccLocalizedString[] description)
{
- Guard.NotNull(description, nameof(description));
-
this.Id = id;
- this.Description = description;
+ this.Description = description ?? throw new ArgumentNullException(nameof(description));
}
///
@@ -48,10 +46,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override int GetHashCode()
{
- unchecked
- {
- return (this.Id.GetHashCode() * 397) ^ (this.Description?.GetHashCode() ?? 0);
- }
+ return HashHelpers.Combine(this.Id.GetHashCode(), this.Description.GetHashCode());
}
}
}
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccResponseNumber.cs b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccResponseNumber.cs
index d1da2366e..c0bae296d 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccResponseNumber.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccResponseNumber.cs
@@ -75,12 +75,9 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override int GetHashCode()
{
- unchecked
- {
- int hashCode = this.DeviceCode.GetHashCode();
- hashCode = (hashCode * 397) ^ this.MeasurementValue.GetHashCode();
- return hashCode;
- }
+ return HashHelpers.Combine(
+ this.DeviceCode.GetHashCode(),
+ this.MeasurementValue.GetHashCode());
}
///
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccScreeningChannel.cs b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccScreeningChannel.cs
index 1c4ac8465..f2e1f31a5 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccScreeningChannel.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccScreeningChannel.cs
@@ -85,13 +85,10 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override int GetHashCode()
{
- unchecked
- {
- int hashCode = this.Frequency.GetHashCode();
- hashCode = (hashCode * 397) ^ this.Angle.GetHashCode();
- hashCode = (hashCode * 397) ^ (int)this.SpotShape;
- return hashCode;
- }
+ return HashHelpers.Combine(
+ this.Frequency.GetHashCode(),
+ this.Angle.GetHashCode(),
+ (int)this.SpotShape);
}
///
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccTagTableEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccTagTableEntry.cs
index 04357dcf6..082ffc679 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccTagTableEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccTagTableEntry.cs
@@ -83,13 +83,10 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override int GetHashCode()
{
- unchecked
- {
- int hashCode = this.Signature.GetHashCode();
- hashCode = (hashCode * 397) ^ this.Offset.GetHashCode();
- hashCode = (hashCode * 397) ^ this.DataSize.GetHashCode();
- return hashCode;
- }
+ return HashHelpers.Combine(
+ this.Signature.GetHashCode(),
+ this.Offset.GetHashCode(),
+ this.DataSize.GetHashCode());
}
///
diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Bgr24.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Bgr24.cs
index 9207f046c..6afa33aff 100644
--- a/src/ImageSharp/PixelFormats/PixelImplementations/Bgr24.cs
+++ b/src/ImageSharp/PixelFormats/PixelImplementations/Bgr24.cs
@@ -191,8 +191,7 @@ namespace SixLabors.ImageSharp.PixelFormats
[MethodImpl(InliningOptions.ShortMethod)]
public override int GetHashCode()
{
- int hash = HashHelpers.Combine(this.R.GetHashCode(), this.G.GetHashCode());
- return HashHelpers.Combine(hash, this.B.GetHashCode());
+ return HashHelpers.Combine(this.R.GetHashCode(), this.B.GetHashCode(), this.G.GetHashCode());
}
}
}
\ No newline at end of file
diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Rgb24.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Rgb24.cs
index 293fe0acb..fe7c299d5 100644
--- a/src/ImageSharp/PixelFormats/PixelImplementations/Rgb24.cs
+++ b/src/ImageSharp/PixelFormats/PixelImplementations/Rgb24.cs
@@ -202,8 +202,7 @@ namespace SixLabors.ImageSharp.PixelFormats
[MethodImpl(InliningOptions.ShortMethod)]
public override int GetHashCode()
{
- int hash = HashHelpers.Combine(this.R.GetHashCode(), this.G.GetHashCode());
- return HashHelpers.Combine(hash, this.B.GetHashCode());
+ return HashHelpers.Combine(this.R.GetHashCode(), this.B.GetHashCode(), this.G.GetHashCode());
}
///
diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Rgb48.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Rgb48.cs
index 81497e5f1..8d06cdbc8 100644
--- a/src/ImageSharp/PixelFormats/PixelImplementations/Rgb48.cs
+++ b/src/ImageSharp/PixelFormats/PixelImplementations/Rgb48.cs
@@ -191,9 +191,7 @@ namespace SixLabors.ImageSharp.PixelFormats
[MethodImpl(InliningOptions.ShortMethod)]
public override int GetHashCode()
{
- return HashHelpers.Combine(
- this.R.GetHashCode(),
- HashHelpers.Combine(this.G.GetHashCode(), this.B.GetHashCode()));
+ return HashHelpers.Combine(this.R.GetHashCode(), this.G.GetHashCode(), this.B.GetHashCode());
}
}
}
\ No newline at end of file