Skip to content

TCardinalHelper.Bits

Read or write a bit.

Declaration

Source position: syshelph.inc line 1129

public property Bits[aIndex : TCardinalBitIndex = 0..31]: Boolean;

Description

Bits property reads or writes boolean value to a bit number determined by argument aIndex.

MyCardinal.Clear;// %00000000000000000000000000000000 MyCardinal equals 0
MyCardinal.Bits[0] := true;  // %00000000000000000000000000000001 MyCardinal equals 1
MyCardinal.Bits[2] := true;  // %00000000000000000000000000000101 MyCardinal equals 5
WriteLn(MyCardinal.Bits[2]); // TRUE

See also

Name Description
TCardinalHelper.SetBit Set bit to 1.
TCardinalHelper.ClearBit Set bit to 0.
TCardinalHelper.ToggleBit Invert bit.
TCardinalHelper.TestBit Check bit.
TCardinalHelper.HighestSetBitPos Return the position of the leftmost bit set.
TCardinalHelper.LowestSetBitPos Return the position of the rightmost bit set.
TCardinalHelper.SetBitsCount Count number of bits set.
TCardinalHelper.Nibbles Read or write a nibble.
TCardinalHelper.Bytes Read or write a byte.
TCardinalHelper.Words Read or write a word.