TVecInt.BitPack Method

Overload List

#SignatureDescription
1function BitPack(const Src: TVecInt): TVecInt; overload;Packs integer storage vector to bit storage.
2function BitPack(const Src: TMtxVecInt; const SrcIndex: integer; const BitIndex: Int64; Len: integer): TMtxVecInt; overload;Converts Src to packed bit storage.

Overload 1: function BitPack(const Src: TVecInt): TVecInt; overload;

Packs integer storage vector to bit storage.

#NameTypeDescription
1SrcTVecIntsource TVecInt

Result: stored in self (calling object), returns self for chaining

Remarks:

If the Src value (32, 16 or 8 bit) at index [i] is not 0, bit [i] of the calling vector is set to 1, otherwise to 0. Bit b of the calling vector is bit (b mod 32) of its value [b div 32]. The BitCount of the calling vector is set to Src.Length, which sizes it and sets its storage precision to prInt32. The bits past BitCount in its last value are set to 0.

Overload 2: function BitPack(const Src: TMtxVecInt; const SrcIndex: integer; const BitIndex: Int64; Len: integer): TMtxVecInt; overload;

Converts Src to packed bit storage.

#NameTypeDescription
1SrcTMtxVecIntsource TVecInt or TMtxInt
2SrcIndexintegersource start index
3BitIndexInt64
4Lenintegerelement count

Result: stored in self (calling object), returns self for chaining

Remarks:

The calling object holds packed bits and its precision must be prInt32. Bit b of the calling object is bit (b mod 32) of its value [b div 32]. If the Src value (32, 16 or 8 bit) at index [SrcIndex + i] is not 0, bit [BitIndex + i] of the calling object is set to 1, otherwise to 0. Returns the result of bit packing the Src values [SrcIndex]..[SrcIndex+Len-1] stored in the calling object (Self) bits [BitIndex]..[BitIndex + Len - 1]. BitIndex is a bit index, counted from bit 0 of the calling object value [0]. SrcIndex is an index of the Src values. The Len parameter specifies the number of bits that will be packed. All other bits of the calling object are preserved, also those which share a value with the packed bits. The storage precision and the size of the calling object are preserved. An exception is raised if ConditionCheck is True and the bits [BitIndex]..[BitIndex + Len - 1] are not within the 32*Length bits of the calling object, or if the values [SrcIndex]..[SrcIndex+Len-1] are not within Src.