devxlogo

June 26, 1999

BitToggle – Invert a bit in a value

‘ Toggle a bit in a value” NOTE: requires Power2()Function BitToggle(ByVal value As Long, ByVal bit As Long) As Long ‘ simply XOR with the negation of the bit mask

RotateRightI – Rotate an Integer to the right

‘ Rotate an Integer to the right the specified number of times” NOTE: requires Power2()Function RotateRightI(ByVal value As Integer, ByVal times As Long) As Integer Dim i As Long, signBits

RotateLeftI – Rotate an Integer to the left

‘ Rotate an Integer to the left the specified number of times” NOTE: requires Power2()Function RotateLeftI(ByVal value As Integer, ByVal times As Long) As Integer Dim i As Long, signBits

ShiftLeft – Shift a Long to the left

‘ Shift to the left of the specified number of times” NOTE: requires Power2()Function ShiftLeft(ByVal value As Long, ByVal times As Long) As Long ‘ we need to create a

BitClear – Clear a bit in a value

‘ Clear a bit in a value” NOTE: requires Power2()Function BitClear(ByVal value As Long, ByVal bit As Long) As Long ‘ simply AND with the negation of the bit mask

BitTest – Test the value of a bit

‘ Test the value of a bit” NOTE: requires Power2()Function BitTest(ByVal value As Long, ByVal bit As Long) As Boolean ‘ simply AND with the bit mask ‘ Range checking

BitSet – Set a bit in a number

‘ Set a bit in a value” NOTE: requires Power2()Function BitSet(ByVal value As Long, ByVal bit As Long) As Long ‘ simply OR with the bit mask ‘ Range checking

RotateRight – Rotate a Long to the right

‘ Rotate a Long to the right the specified number of times” NOTE: requires Power2()Function RotateRight(ByVal value As Long, ByVal times As Long) As Long Dim i As Long, signBits

RotateLeft – Rotate a Long to the left

‘ Rotate a Long to the left the specified number of times” NOTE: requires Power2()Function RotateLeft(ByVal value As Long, ByVal times As Long) As Long Dim i As Long, signBits