diff --git a/src/ImageSharp/Formats/Gif/LzwEncoder.cs b/src/ImageSharp/Formats/Gif/LzwEncoder.cs
index 6c3ede379a..1dc7e99e83 100644
--- a/src/ImageSharp/Formats/Gif/LzwEncoder.cs
+++ b/src/ImageSharp/Formats/Gif/LzwEncoder.cs
@@ -53,6 +53,11 @@ namespace SixLabors.ImageSharp.Formats.Gif
///
private const int MaxBits = 12;
+ ///
+ /// Should NEVER generate this code.
+ ///
+ private const int MaxMaxCode = 1 << MaxBits;
+
///
/// The working pixel array.
///
@@ -93,11 +98,6 @@ namespace SixLabors.ImageSharp.Formats.Gif
///
private int maxCode;
- ///
- /// should NEVER generate this code
- ///
- private int maxmaxcode = 1 << MaxBits;
-
///
/// For dynamic table sizing
///
@@ -341,7 +341,7 @@ namespace SixLabors.ImageSharp.Formats.Gif
this.Output(ent, stream);
ent = c;
- if (this.freeEntry < this.maxmaxcode)
+ if (this.freeEntry < MaxMaxCode)
{
Unsafe.Add(ref codeTableRef, i) = this.freeEntry++; // code -> hashtable
Unsafe.Add(ref hashTableRef, i) = fcode;
@@ -423,7 +423,7 @@ namespace SixLabors.ImageSharp.Formats.Gif
{
++this.bitCount;
this.maxCode = this.bitCount == MaxBits
- ? this.maxmaxcode
+ ? MaxMaxCode
: GetMaxcode(this.bitCount);
}
}