Table of Contents

Class BitVector

Namespace
Echo.Memory
Assembly
Echo.dll

Represents an array of bits for which the concrete may be known or unknown, and can be reinterpreted as different value types, and operated on using the different semantics of these types.

public class BitVector : ICloneable
Inheritance
BitVector
Implements
Inherited Members

Constructors

BitVector(BitVectorSpan)

Copies a span into a new bit vector.

public BitVector(BitVectorSpan span)

Parameters

span BitVectorSpan

The span to copy.

BitVector(byte)

Creates a new fully known 8-wide bit vector.

public BitVector(byte value)

Parameters

value byte

The bits.

BitVector(byte, byte)

Creates a new partially known 8-wide bit vector.

public BitVector(byte bits, byte knownMask)

Parameters

bits byte

The bits.

knownMask byte

The bitmask indicating which bits in bits are known.

BitVector(byte[])

Wraps a byte array into a fully known bit vector.

public BitVector(byte[] bits)

Parameters

bits byte[]

The raw bits to wrap.

BitVector(byte[], byte[])

Wraps a pair of byte arrays into a partially known bit vector.

public BitVector(byte[] bits, byte[] knownMask)

Parameters

bits byte[]

The raw bits to wrap.

knownMask byte[]

The bitmask indicating which bits in bits are known.

BitVector(double)

Creates a new fully known 64-wide bit vector based on a floating point number.

public BitVector(double value)

Parameters

value double

The bits.

BitVector(short)

Creates a new fully known 16-wide bit vector.

public BitVector(short value)

Parameters

value short

The bits.

BitVector(short, ushort)

Creates a new partially known 16-wide bit vector.

public BitVector(short bits, ushort knownMask)

Parameters

bits short

The bits.

knownMask ushort

The bitmask indicating which bits in bits are known.

BitVector(int)

Creates a new fully known 32-wide bit vector.

public BitVector(int value)

Parameters

value int

The bits.

BitVector(int, bool)

Creates a new bit vector of the provided size.

public BitVector(int count, bool initialize)

Parameters

count int

The number of bits in the vector.

initialize bool

Indicates the bitvector should be initialized with zeroes.

Exceptions

ArgumentOutOfRangeException

Occurs when count is not a multiple of 8.

BitVector(int, uint)

Creates a new partially known 32-wide bit vector.

public BitVector(int bits, uint knownMask)

Parameters

bits int

The bits.

knownMask uint

The bitmask indicating which bits in bits are known.

BitVector(long)

Creates a new fully known 64-wide bit vector.

public BitVector(long value)

Parameters

value long

The bits.

BitVector(long, ulong)

Creates a new partially known 64-wide bit vector.

public BitVector(long bits, ulong knownMask)

Parameters

bits long

The bits.

knownMask ulong

The bitmask indicating which bits in bits are known.

BitVector(sbyte)

Creates a new fully known 8-wide bit vector.

public BitVector(sbyte value)

Parameters

value sbyte

The bits.

BitVector(sbyte, byte)

Creates a new partially known 8-wide bit vector.

public BitVector(sbyte bits, byte knownMask)

Parameters

bits sbyte

The bits.

knownMask byte

The bitmask indicating which bits in bits are known.

BitVector(float)

Creates a new fully known 32-wide bit vector based on a floating point number.

public BitVector(float value)

Parameters

value float

The bits.

BitVector(ushort)

Creates a new fully known 16-wide bit vector.

public BitVector(ushort value)

Parameters

value ushort

The bits.

BitVector(ushort, ushort)

Creates a new partially known 16-wide bit vector.

public BitVector(ushort bits, ushort knownMask)

Parameters

bits ushort

The bits.

knownMask ushort

The bitmask indicating which bits in bits are known.

BitVector(uint)

Creates a new fully known 32-wide bit vector.

public BitVector(uint value)

Parameters

value uint

The bits.

BitVector(uint, uint)

Creates a new partially known 32-wide bit vector.

public BitVector(uint bits, uint knownMask)

Parameters

bits uint

The bits.

knownMask uint

The bitmask indicating which bits in bits are known.

BitVector(ulong)

Creates a new fully known 64-wide bit vector.

public BitVector(ulong value)

Parameters

value ulong

The bits.

BitVector(ulong, ulong)

Creates a new partially known 64-wide bit vector.

public BitVector(ulong bits, ulong knownMask)

Parameters

bits ulong

The bits.

knownMask ulong

The bitmask indicating which bits in bits are known.

Properties

Bits

Gets the raw bits stored in this bit vector.

public byte[] Bits { get; }

Property Value

byte[]

ByteCount

Gets the number of bytes stored in the bit vector.

public int ByteCount { get; }

Property Value

int

Count

Gets the number of bits stored in the bit vector.

public int Count { get; }

Property Value

int

IsFullyKnown

Gets a value indicating whether all bits in the vector are known.

public bool IsFullyKnown { get; }

Property Value

bool

KnownMask

Gets a bit mask indicating which bits in Bits are known.

public byte[] KnownMask { get; }

Property Value

byte[]

Methods

AsSpan()

Creates a new span of the entire bit vector.

public BitVectorSpan AsSpan()

Returns

BitVectorSpan

The constructed span.

AsSpan(int)

Creates a new span of a portion of the bit vector that starts at a provided bit index.

public BitVectorSpan AsSpan(int bitIndex)

Parameters

bitIndex int

The index to start the span at.

Returns

BitVectorSpan

The constructed span.

AsSpan(int, int)

Creates a new span of a portion of the bit vector that starts at a provided bit index and has a provided length.

public BitVectorSpan AsSpan(int bitIndex, int length)

Parameters

bitIndex int

The index to start the span at.

length int

The number of bits in the slice.

Returns

BitVectorSpan

The constructed span.

Clone()

Deep copies the bit vector.

public BitVector Clone()

Returns

BitVector

The copied bit vector.

Clone(BitVectorPool)

Deep copies the bit vector.

public BitVector Clone(BitVectorPool pool)

Parameters

pool BitVectorPool

The pool to rent the cloned bitvector from.

Returns

BitVector

The copied bit vector.

ParseBinary(string)

Parses a binary string, where the least significant bit is at the end of the string, into a bit vector.

public static BitVector ParseBinary(string binaryString)

Parameters

binaryString string

The binary string to parse. This string may contain unknown bits (?).

Returns

BitVector

The parsed bit vector.

Resize(int, bool)

Allocates a new bit vector that contains the same data, but is extended or truncated to a new size.

public BitVector Resize(int newSize, bool signExtend)

Parameters

newSize int

The new size.

signExtend bool

When newSize is larger than the original size, a value indicating whether the vector should be sign extended or not.

Returns

BitVector

The new vector.

Resize(int, bool, BitVectorPool)

Rents a bit vector from a pool that contains the same data, but is extended or truncated to a new size.

public BitVector Resize(int newSize, bool signExtend, BitVectorPool pool)

Parameters

newSize int

The new size.

signExtend bool

When newSize is larger than the original size, a value indicating whether the vector should be sign extended or not.

pool BitVectorPool

The pool to rent the new vector from.

Returns

BitVector

The new vector.

ToString()

public override string ToString()

Returns

string

Operators

implicit operator BitVector(byte)

Creates a new fully known 8-wide bit vector.

public static implicit operator BitVector(byte value)

Parameters

value byte

The bits.

Returns

BitVector

implicit operator BitVector(double)

Creates a new fully known 64-wide bit vector.

public static implicit operator BitVector(double value)

Parameters

value double

The bits.

Returns

BitVector

implicit operator BitVector(short)

Creates a new fully known 16-wide bit vector.

public static implicit operator BitVector(short value)

Parameters

value short

The bits.

Returns

BitVector

implicit operator BitVector(int)

Creates a new fully known 32-wide bit vector.

public static implicit operator BitVector(int value)

Parameters

value int

The bits.

Returns

BitVector

implicit operator BitVector(long)

Creates a new fully known 64-wide bit vector.

public static implicit operator BitVector(long value)

Parameters

value long

The bits.

Returns

BitVector

implicit operator BitVector(sbyte)

Creates a new fully known 8-wide bit vector.

public static implicit operator BitVector(sbyte value)

Parameters

value sbyte

The bits.

Returns

BitVector

implicit operator BitVector(float)

Creates a new fully known 32-wide bit vector.

public static implicit operator BitVector(float value)

Parameters

value float

The bits.

Returns

BitVector

implicit operator BitVector(ushort)

Creates a new fully known 16-wide bit vector.

public static implicit operator BitVector(ushort value)

Parameters

value ushort

The bits.

Returns

BitVector

implicit operator BitVector(uint)

Creates a new fully known 32-wide bit vector.

public static implicit operator BitVector(uint value)

Parameters

value uint

The bits.

Returns

BitVector

implicit operator BitVector(ulong)

Creates a new fully known 64-wide bit vector.

public static implicit operator BitVector(ulong value)

Parameters

value ulong

The bits.

Returns

BitVector