Bit Shifting in VB

Bit Shifting in VB

The basic principal of this function is to divide the decimal number by two for bit number of times (if that makes sense). So, if bit 30 was to be checked the number would be divided by two 30 times. This is the basic principal in “shifting bits right.” To shift bits left, simply multiply by two. The result’s mod 2 will determine whether or not the bit is set.

 Public Sub Foo()    Dim iVal as integer    iVal = &HA0            '10100000    iVal = RShift16(iVal, 4)    Debug.Print iVal 'Now it's 00001010End Sub Function LShift16(w As Integer, c As Integer) As Integer    'Bitwise left shift for short integers.    LShift16 = w * (2 ^ c)End Function Function RShift16(w As Integer, c As Integer) As Integer    'Bitwise right shift for short integers.    RShift16 = w  (2 ^ c)End Function
Share the Post:
Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular

XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved

AI is revolutionizing fraud detection

How AI is Revolutionizing Fraud Detection

Artificial intelligence – commonly known as AI – means a form of technology with multiple uses. As a result, it has become extremely valuable to a number of businesses across

AI innovation

Companies Leading AI Innovation in 2023

Artificial intelligence (AI) has been transforming industries and revolutionizing business operations. AI’s potential to enhance efficiency and productivity has become crucial to many businesses. As we move into 2023, several