Skip to content

TByteHelper.Bits

Read or write a bit.

Declaration

Source position: syshelph.inc line 907

public property Bits[aIndex : TByteBitIndex = 0..7]: Boolean;

Description

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

MyByte.Clear;// %00000000 MyByte equals 0
MyByte.Bits[0] := true;  // %00000001 MyByte equals 1
MyByte.Bits[2] := true;  // %00000101 MyByte equals 5
WriteLn(MyByte.Bits[2]); // TRUE

See also

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