Browse Source

Make MaxMaxCode const

af/merge-core
Jason Nelson 8 years ago
parent
commit
cb44bbb633
  1. 14
      src/ImageSharp/Formats/Gif/LzwEncoder.cs

14
src/ImageSharp/Formats/Gif/LzwEncoder.cs

@ -53,6 +53,11 @@ namespace SixLabors.ImageSharp.Formats.Gif
/// </summary>
private const int MaxBits = 12;
/// <summary>
/// Should NEVER generate this code.
/// </summary>
private const int MaxMaxCode = 1 << MaxBits;
/// <summary>
/// The working pixel array.
/// </summary>
@ -93,11 +98,6 @@ namespace SixLabors.ImageSharp.Formats.Gif
/// </summary>
private int maxCode;
/// <summary>
/// should NEVER generate this code
/// </summary>
private int maxmaxcode = 1 << MaxBits;
/// <summary>
/// For dynamic table sizing
/// </summary>
@ -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);
}
}

Loading…
Cancel
Save