xlvba is bit set in 64-bit integer

'Extremely fast VBA function to test if a specified bit is set 
'within a 64-bit LongLong integer.

'Bits are numbered from 0 to 63, so the first (least significant) bit
'is bit 0.

'Note: we do not inspect bit 63, the sign bit.
'Note: the LongLong data type is only available in 64-bit VBA.


Function LongLongBitIsSet(theLongLong^, bit As Byte) As Boolean
    Static i&, b^()
    If (Not Not b) = 0 Then
        ReDim b(0 To 62)
        For i = 0 To 62
            b(i) = 2 ^ i
        Next
    End If
    If bit < 63 Then LongLongBitIsSet = theLongLong And b(bit)
End Function


'------------------------------------------------------------------
MsgBox LongBitIsSet(255, 7)                       '<--displays: True
MsgBox LongBitIsSet(230, 0)                       '<--displays: False
MsgBox LongBitIsSet(16384, 14)                    '<--displays: True
MsgBox LongBitIsSet(-16383, 0)                    '<--displays: True
MsgBox LongBitIsSet(&H7FFFFFFF, 0), 0)            '<--displays: True
MsgBox LongLongBitIsSet(&H7FFFFFFFFFFFFFff^, 62)  '<--displays: True
'
'
'




Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
excelvba 32-bit long integer to bits excel vba test if specific bits set in 64-bit longlong integer excel vba check if specific bits set in 64-bit longlong integer excel vba check if specific bits set in longlong integer excel vba check if specific bits set in longlong excel vba check if specific bits are set in 64-bit longlong integer excelvba check if specific bits are set in 64-bit longlong integer vba check if specific bits are set in 64-bit longlong integer vba check if certain bits are set in 64-bit longlong integer excel vba check if certain bits are set in 64-bit longlong integer excel vba check if certain bits are set in 64bit longlong integer excel vba check if certain bits are set in longlong integer vba check if certain bits are set in longlong integer vba check if particular bits set in 64-bit longlong integer excel vba test if particular bits set in long integer vba check if specific bits set in int32 excel vba test if specific bits set in long integer excel vba test if specific bits are set in long integer vba check if specific bits are set in long integer excel xl vba check if specific bits are set in long integer excelvba check if specific bits are set in long integer excel vba check if specific bits are set in long integer excel vba check if specific bits set in long integer excel vba inspect if bit is set in 64-bit longlong integer vba inspect if bit is set in 64-bit longlong integer xlvba check if bit is set in 64-bit longlong integer xl vba check if bit is set in 64-bit longlong integer excelvba check if bit is set in 64-bit longlong integer excel vba check if bit is set in 64-bit longlong integer vba check if bit is set in 64-bit longlong integer xlvba check if bit set in 64-bit longlong integer xl vba check if bit set in 64-bit longlong integer excelvba check if bit set in 64-bit longlong integer excel vba check if bit set in 64-bit longlong integer vba check if bit set in 64-bit longlong integer xlvba is bit set in 64-bit longlong integer xl vba is bit set in 64-bit longlong integer excelvba is bit set in 64-bit longlong integer excel vba is bit set in 64-bit longlong integer vba is bit set in 64-bit longlong integer xlvba is bit set in 64-bit integer xl vba is bit set in 64-bit integer excelvba is bit set in 64-bit integer excel vba is bit set in 64-bit integer vba is bit set in longlong integer vba is specific bit set in longlong integer excelvba is specific bit set in longlong integer excel vba is specific bit set in longlong integer xl vba is specific bit set in longlong integer
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source