1
0
mirror of https://github.com/chylex/Brotli-Builder.git synced 2024-12-22 16:42:46 +01:00
Brotli-Builder/BrotliLib/Serialization/Writer/BitWriterNull.cs

37 lines
925 B
C#

using BrotliLib.Collections.Huffman;
namespace BrotliLib.Serialization.Writer{
public class BitWriterNull : IBitWriter{
public int Length { get; private set; }
public void WriteBit(bool bit){
Length += 1;
}
public void WriteBits(BitStream bits){
Length += bits.Length;
}
public void WriteBits(in BitPath bits){
Length += bits.Length;
}
public void WriteChunk(int count, int value){
Length += count;
}
public void AlignToByteBoundary(){
int relativeIndex = Length & BitStream.ByteMask;
if (relativeIndex > 0){
Length += BitStream.ByteSize - relativeIndex;
}
}
public void WriteAlignedBytes(byte[] bytes){
AlignToByteBoundary();
Length += bytes.Length * BitStream.ByteSize;
}
}
}