Skip to content

TShortIntHelper.ToggleBit

Invert bit.

Declaration

Source position: syshelph.inc line 946

public 
function TShortIntHelper.ToggleBit(const Index: TShortIntBitIndex)
                                   : ShortInt;

Description

ToggleBit reads bit value from bit number determined by argument Index, inverts it (if it was 0 it becomes 1, and vice versa), and stores it back.

See also

Name Description
TShortIntHelper.SetBit Set bit to 1.
TShortIntHelper.ClearBit Set bit to 0.
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.Bits Read or write a bit.