Class BitArrayExtensions
- Namespace
- Net.Codecrete.QrCodeGenerator
- Assembly
- QrCodeGenerator.dll
Extension methods for the BitArray class.
public static class BitArrayExtensions
- Inheritance
-
BitArrayExtensions
- Inherited Members
Methods
AppendBits(BitArray, uint, int)
Appends the specified number bits of the specified value to this bit array.
The least significant bits of the specified value are added. They are appended in reverse order, from the most significant to the least significant one, i.e. bits 0 to len-1 are appended in the order len-1, len-2 ... 1, 0.
Requires 0 ≤ len ≤ 31, and 0 ≤ val < 2len.
public static void AppendBits(this BitArray bitArray, uint val, int len)
Parameters
bitArrayBitArrayThe BitArray instance that this method extends.
valuintThe value to append.
lenintThe number of low-order bits in the value to append.
Exceptions
- ArgumentOutOfRangeException
Value or number of bits is out of range.
AppendData(BitArray, BitArray)
Appends the content of the specified bit array to the end of this array.
public static void AppendData(this BitArray bitArray, BitArray otherArray)
Parameters
bitArrayBitArrayThe BitArray instance that this method extends.
otherArrayBitArrayThe bit array to append
Exceptions
- ArgumentNullException
If
bitArrayisnull.
ExtractBits(BitArray, int, int)
Extracts the specified number of bits at the specified index in this bit array.
The bit at index index becomes the most significant bit of the result,
The bit at index index + len - 1 becomes the least significant bit.
Requires 0 ≤ len ≤ 31, 0 ≤ index, and index + len ≤ bit array length.
public static uint ExtractBits(this BitArray bitArray, int index, int len)
Parameters
bitArrayBitArrayThe BitArray instance that this method extends.
indexintThe index of the first bit to extract.
lenintThe number of bits to extract.
Returns
- uint
The extracted bits as an unsigned integer.
Exceptions
- ArgumentOutOfRangeException
Index or length is out of range.