src/AnvilPacker/Data/IO/BitWriter.cs
/// <summary> Writes <paramref name="count"/> bits to the stream. </summary>
/// <param name="count">Number of bits to write. Must be between 0 and 32 (inclusive) </param>
Writes  bits to the stream.
Writes bits to the stream .
public void WriteBits(int value, int count)
        {
            Debug.Assert(count is >= 0 and <= 32);
            ulong v = Mem.ReadLE<ulong>(_buf, _pos >> 3);
            ulong mask = (1ul << count) - 1;
            int shift = _pos & 7;
            v |= ((ulong)value & mask) << shift;
            Mem.WriteLE<ulong>(_buf, _pos >> 3, v);
            _pos += count;
            if (_pos >= BUFFER_SIZE << 3) {
                FlushBuffer(false);
            }
        }
public void WriteBits ( int value , int count ) { Debug . Assert ( count is >= 0 and <= 32 ) ; ulong v = Mem . ReadLE < ulong > ( _buf , _pos >> 3 ) ; ulong mask = ( 1ul << count ) - 1 ; int shift = _pos & 7 ; v |= ( ( ulong ) value & mask ) << shift ; Mem . WriteLE < ulong > ( _buf , _pos >> 3 , v ) ; _pos += count ; if ( _pos >= BUFFER_SIZE << 3 ) { FlushBuffer ( false ) ; } }
Writes  bits to the stream.
Writes bits to the stream .
value
int
count
int
Number of bits to write. Must be between 0 and 32 (inclusive)
Number of bits to write . Must be between 0 and 32 ( inclusive )