Move FastByteReader from LCW to own file
And make it public. Making it easier to move formats that depend on it to Mods.Cnc independently later.
This commit is contained in:
@@ -14,34 +14,6 @@ using System.IO;
|
||||
|
||||
namespace OpenRA.Mods.Common.FileFormats
|
||||
{
|
||||
class FastByteReader
|
||||
{
|
||||
readonly byte[] src;
|
||||
int offset;
|
||||
|
||||
public FastByteReader(byte[] src, int offset = 0)
|
||||
{
|
||||
this.src = src;
|
||||
this.offset = offset;
|
||||
}
|
||||
|
||||
public bool Done() { return offset >= src.Length; }
|
||||
public byte ReadByte() { return src[offset++]; }
|
||||
public int ReadWord()
|
||||
{
|
||||
var x = ReadByte();
|
||||
return x | (ReadByte() << 8);
|
||||
}
|
||||
|
||||
public void CopyTo(byte[] dest, int offset, int count)
|
||||
{
|
||||
Array.Copy(src, this.offset, dest, offset, count);
|
||||
this.offset += count;
|
||||
}
|
||||
|
||||
public int Remaining() { return src.Length - offset; }
|
||||
}
|
||||
|
||||
// Lempel - Castle - Welch algorithm (aka Format80)
|
||||
public static class LCWCompression
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user