JCL Help:BooleansToBits@Byte@TBooleanArray

From Project JEDI Wiki
Jump to navigationJump to search


Summary

Packs an array of booleans into a set of bits.


Pascal

 procedure BooleansToBits(var Dest: Byte; const B: TBooleanArray); overload;
procedure BooleansToBits(var Dest: Word; const B: TBooleanArray); overload;
procedure BooleansToBits(var Dest: Integer; const B: TBooleanArray); overload;
procedure BooleansToBits(var Dest: Int64; const B: TBooleanArray); overload;


Parameters

Parameters Description
var Dest: Byte Integer type variable in which the appropriate bits are set/cleared.
const B: TBooleanArray The array of Booleans to pack into a set of bits. Note that the upper bound of this array must not be larger then the size of the Dest parameters, in bits. Thus, for the Byte variant this array must not be larger then 8 elements.


Description

BooleansToBits packs the array of booleans into a set of bits. Each boolean in the array which is set to True results in a 1 bit in the Dest variable while each False valued boolean results in a 0 bit. The BitsToBooleans routine performs the inverse operation. Note that if the array contains more elements than can fit into the destination variable, the elements in the array with index larger than the highest bit (i.e. 7 for a byte) in the destination variable will be ignored.


See Also

BitsToBooleans


About

Unit

JclLogic


Donator

Robert Marquardt


Contribute to this help topic

This documentation wiki is based on the collaborative effort of Project JEDI users. Your edits are welcome in order to improve documentation quality: edit this page