Function Bitwise Class

GetBitInStringFast

Get a bit from a binary string. Bits range from 1 (one is the least-significant-bit) to the number of bits in the value.

Signature (Visual Basic / VBA)

Public Function GetBitInStringFast( _
      ByRef vValue As String _
    , ByRef vBit As Long _
    ) As Boolean

Code Example

    GetBitInStringFast(Chr$(2) + Chr$(0), 2)  = True
    GetBitInStringFast(Chr$(2) + Chr$(0), 10) = False
    GetBitInStringFast(Chr$(0) + Chr$(2), 2)  = False
    GetBitInStringFast(Chr$(0) + Chr$(2), 10) = True

Parameters

Parameter Description
vValue The string from which the value of one of the bits within one of its characters will be returned.
vBit The number of the bit whose value within string vValue is to be returned.

Notes & Version History

Note This function is different from GetBit and SetBit because this one considers the first string character to represent the LEAST-significant-byte instead of the MOST-significant-byte.
Note This function assumes that vBit represents one of the bits within the string vValue and its behavior will be unpredictable if that is not true.
Note Function has restrictive argument types to avoid argument fix-up overhead.