Private Function lBSL(ByRef lInput As Long, ByRef bShiftBits As Byte) As Long lBSL = (lInput And (2 ^ (31 - bShiftBits) - 1)) * 2 ^ bShiftBits If (lInput And 2 ^ (31 - bShiftBits)) = 2 ^ (31 - bShiftBits) Then lBSL = (lBSL Or &H80000000) End Function Private Function lBSR(ByRef lInput As Long, ByRef bShiftBits As Byte) As Long If (bShiftBits = 31) Then If (lInput < 0) Then lBSR = &HFFFFFFFF Else lBSR = 0 Else lBSR = (lInput And Not (2 ^ bShiftBits - 1)) \ 2 ^ bShiftBits End If End Function Private Function lBSRU(lInput As Long, bShiftBits As Byte) As Long If (bShiftBits = 31) Then lBSRU = -(lInput < 0) Else lBSRU = (((lInput And Not (2 ^ bShiftBits - 1)) \ 2 ^ bShiftBits) And Not (&H80000000 + (2 ^ bShiftBits - 2) * 2 ^ (31 - bShiftBits))) End If End Function