Sign in Join
FPDoc Onlineexperiment

TBits class

In unit Classes

Class to store collections of bits (binary values that can be 0 or 1).

Declaration

pascal
TBits = class(TObject)

Inheritance

  1. TBits
  2. 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

BitspublicAccess to all bits in the array.
SizepublicCurrent size of the array of bits.

Methods

CheckBitIndexprotected
CreatepublicCreates a new bits collection.
DestroypublicDestroys a bit collection.
GetFSizepublicReturns the number of records used to store the bits.
SetOnpublicTurn a particular bit on.
ClearpublicClears a particular bit.
ClearallpublicClears all bits in the array.
CopyBitspublicCopy bits from one bits set to another.
AndBitspublicPerforms an and operation on the bits.
OrBitspublicPerforms an or operation on the bits.
XorBitspublicPerforms a xor operation on the bits.
NotBitspublicPerforms a not operation on the bits.
GetpublicRetrieve the value of a particular bit.
GrowpublicExpands the bits array to the requested size.
EqualspublicDetermines whether the bits of 2 arrays are equal.
SetIndexpublicSets the start position for FindNextBit and FindPrevBit.
FindFirstBitpublicFind first bit with a particular value.
FindNextBitpublicSearches the next bit with a particular value.
FindPrevBitpublicSearches the previous bit with a particular value.
Findpublic
FindRevpublic
Find0public
Find0Revpublic
Find1public
Find1Revpublic
OpenBitpublicReturns the position of the first bit that is set to False.
MoveRangepublic
GetUintpublic
SetUintpublic
NotRangepublic
AndRangepublic
OrRangepublic
XorRangepublic
AndNotRangepublic
OpRangepublic
ClearRangepublic
SetRangepublic
PopCountpublic
IntersectionPopCountpublic
HasIntersectionpublic
DumpBinarypublic
LoadBinarypublic
DumpTextpublic
LoadTextpublic

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.