Public Function RShift(ByVal lThis, ByVal lBits) On Error Resume Next Init If (lBits = 0) Then RShift = lThis ElseIf (lBits > 63) Then ' .. error ... ElseIf (lBits > 31) Then RShift = 0 Else If (lThis And m_lPower2(31 - lBits)) = m_lPower2(31 - lBits) Then RShift = (lThis And (m_lPower2(31 - lBits) - 1)) * m_lPower2(lBits) Or m_lPower2(31) Else RShift = (lThis And (m_lPower2(31 - lBits) - 1)) * m_lPower2(lBits) End If End If End Function
Public Function LShift(ByVal lThis, ByVal lBits) On Error Resume Next Init If (lBits = 0) Then LShift = lThis ElseIf (lBits > 63) Then ' ... error ... ElseIf (lBits > 31) Then LShift = 0 Else If (lThis And m_lPower2(31)) = m_lPower2(31) Then LShift = (lThis And H7FFFFFFF) \&;m_lPower2(lBits) Or m_lPower2(31 - lBits) Else LShift = lThis \&;m_lPower2(lBits) End If End If End Function