Skip to content

TShortIntHelper.Bits

Read or write a bit.

Declaration

Source position: syshelph.inc line 952

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

Description

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

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

See also

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