Function Bitwise Class

FlipBit

Perform the logical "Not" operation on one of the bits within a value. Function uses the GetBit and SetBit functions; see them for details.

Signature (Visual Basic / VBA)

Public Function FlipBit( _
      ByVal vValue As Variant _
    , ByVal vBit As Variant _
    ) As Variant

Code Examples

    FlipBit(0, 5) = 16
    FlipBit(-1, 5) = -17
    FlipBit(255, 5) = 239
    FlipBit("BC", 5) = "BS"
    NOT
        +---
      0 | 1
      1 | 0

Parameters

Parameter Description
vValue Value in which the Not operation will be performed on one of its bits. Function returns Null if vValue is Null.
vBit The number of the bit on which the Not operation will be performed. Function returns Null if vBit is Null or cannot be fixed up to a number. Function returns Null if vBit is <= 0 (less than or equal to zero). Function returns Null if vBit is greater than the number of bits within the value vValue.