fix: Removes custom BitArray (#1597)

### Summary

The BitArray class will be optimized over the next several years for various platforms/hardware and maintaining a duplicate for serialization is not practical. Removing the custom implementation. Recommend against using BitArray for serialization unless it is absolutely necessary.
This commit is contained in:
Kamron Batman 2023-11-17 14:37:07 -08:00 • committed by GitHub
parent a1dffd10ce
commit e9642d61f1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 32 additions and 1489 deletions

View file

@ -15,6 +15,7 @@
using System;
using System.Buffers.Binary;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
@ -221,21 +222,6 @@ public class BufferReader : IGenericReader
return length;
}
public BitArray ReadBitArray()
{
var bitLength = ((IGenericReader)this).ReadEncodedInt();
var length = BitArray.GetByteArrayLengthFromBitLength(bitLength);
if (length > _buffer.Length - _position)
{
throw new OutOfMemoryException();
}
var bitArray = new BitArray(_buffer.AsSpan(_position, length), bitLength);
_position += length;
return bitArray;
}
public virtual long Seek(long offset, SeekOrigin origin)
{
Debug.Assert(