Browse Source

Minor cleanup tweaks

af/merge-core
JimBobSquarePants 9 years ago
parent
commit
d2f6a8534f
  1. 8
      src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/Bits.cs
  2. 11
      src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/Bytes.cs

8
src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/Bits.cs

@ -92,8 +92,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int ReceiveExtend(int t, ref InputProcessor inputProcessor)
{
int x;
OrigDecoderErrorCode errorCode = this.ReceiveExtendUnsafe(t, ref inputProcessor, out x);
OrigDecoderErrorCode errorCode = this.ReceiveExtendUnsafe(t, ref inputProcessor, out int x);
errorCode.EnsureNoError();
return x;
}
@ -120,7 +119,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
this.UnreadBits -= t;
this.Mask >>= t;
int s = 1 << t;
x = (int)((this.Accumulator >> this.UnreadBits) & (s - 1));
x = (this.Accumulator >> this.UnreadBits) & (s - 1);
if (x < (s >> 1))
{
@ -132,8 +131,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
private OrigDecoderErrorCode EnsureBitsStepImpl(ref InputProcessor inputProcessor)
{
int c;
OrigDecoderErrorCode errorCode = inputProcessor.Bytes.ReadByteStuffedByteUnsafe(inputProcessor.InputStream, out c);
OrigDecoderErrorCode errorCode = inputProcessor.Bytes.ReadByteStuffedByteUnsafe(inputProcessor.InputStream, out int c);
if (errorCode != OrigDecoderErrorCode.NoError)
{

11
src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/Bytes.cs

@ -59,10 +59,10 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
public static Bytes Create()
{
return new Bytes
{
Buffer = BytePool.Rent(BufferSize),
BufferAsInt = IntPool.Rent(BufferSize)
};
{
Buffer = BytePool.Rent(BufferSize),
BufferAsInt = IntPool.Rent(BufferSize)
};
}
/// <summary>
@ -148,8 +148,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public byte ReadByte(Stream inputStream)
{
byte result;
OrigDecoderErrorCode errorCode = this.ReadByteUnsafe(inputStream, out result);
OrigDecoderErrorCode errorCode = this.ReadByteUnsafe(inputStream, out byte result);
errorCode.EnsureNoError();
return result;
}

Loading…
Cancel
Save