mirror of
https://github.com/chylex/Brotli-Builder.git
synced 2024-12-22 07:42:47 +01:00
37 lines
925 B
C#
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;
|
|
}
|
|
}
|
|
}
|