TBits class
Class to store collections of bits (binary values that can be 0 or 1).
Declaration
TBits = class(TObject)Inheritance
- TBits
- TObject
Description
TBits can be used to store collections of bits in an indexed
array. This is especially useful for storing collections of booleans:
Normally the size of a boolean is the size of the smallest enumerated type,
i.e. 1 byte. Since a bit can take 2 values it can be used to store a boolean
as well. Since TBits can store 8 bits in a byte, it takes 8 times less space
to store an array of booleans in a TBits class then it would take to store
them in a conventional array.
TBits introduces methods to store and retrieve bit values,
apply masks, and search for bits.
Properties
Bits | public | Access to all bits in the array. |
Size | public | Current size of the array of bits. |
Methods
CheckBitIndex | protected | |
Create | public | Creates a new bits collection. |
Destroy | public | Destroys a bit collection. |
GetFSize | public | Returns the number of records used to store the bits. |
SetOn | public | Turn a particular bit on. |
Clear | public | Clears a particular bit. |
Clearall | public | Clears all bits in the array. |
CopyBits | public | Copy bits from one bits set to another. |
AndBits | public | Performs an and operation on the bits. |
OrBits | public | Performs an or operation on the bits. |
XorBits | public | Performs a xor operation on the bits. |
NotBits | public | Performs a not operation on the bits. |
Get | public | Retrieve the value of a particular bit. |
Grow | public | Expands the bits array to the requested size. |
Equals | public | Determines whether the bits of 2 arrays are equal. |
SetIndex | public | Sets the start position for FindNextBit and FindPrevBit. |
FindFirstBit | public | Find first bit with a particular value. |
FindNextBit | public | Searches the next bit with a particular value. |
FindPrevBit | public | Searches the previous bit with a particular value. |
Find | public | |
FindRev | public | |
Find0 | public | |
Find0Rev | public | |
Find1 | public | |
Find1Rev | public | |
OpenBit | public | Returns the position of the first bit that is set to False. |
MoveRange | public | |
GetUint | public | |
SetUint | public | |
NotRange | public | |
AndRange | public | |
OrRange | public | |
XorRange | public | |
AndNotRange | public | |
OpRange | public | |
ClearRange | public | |
SetRange | public | |
PopCount | public | |
IntersectionPopCount | public | |
HasIntersection | public | |
DumpBinary | public | |
LoadBinary | public | |
DumpText | public | |
LoadText | public |
Inherited
From TObject (39)
AfterConstruction BeforeDestruction CheckDisposed ClassInfo ClassName ClassNameIs ClassParent ClassType CleanupInstance DefaultHandler DefaultHandlerStr Dispatch DispatchStr Disposed DisposeOf FieldAddress Free FreeInstance GetDisposed GetHashCode GetInterface GetInterfaceByStr GetInterfaceEntry GetInterfaceEntryByStr GetInterfaceTable GetInterfaceWeak GetLastCastErrorInfo InheritsFrom InitInstance InstanceSize MethodAddress MethodName newinstance QualifiedClassName SafeCallException StringMessageTable SystemHasExtendedRTTI ToString UnitName
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
