Table of Contents

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

bitArray BitArray

The BitArray instance that this method extends.

val uint

The value to append.

len int

The 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

bitArray BitArray

The BitArray instance that this method extends.

otherArray BitArray

The bit array to append

Exceptions

ArgumentNullException

If bitArray is null.

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 + lenbit array length.

public static uint ExtractBits(this BitArray bitArray, int index, int len)

Parameters

bitArray BitArray

The BitArray instance that this method extends.

index int

The index of the first bit to extract.

len int

The number of bits to extract.

Returns

uint

The extracted bits as an unsigned integer.

Exceptions

ArgumentOutOfRangeException

Index or length is out of range.