<-- Previous || Up || Next -->

Bitwise Min And Max Values Verify Sub
Bitwise Class

Private Sub BitwiseMinAndMaxValuesVerify()
    ' "Binary Minimum And Maximum Values Verify"
    ' Determines the min. and max. values returned by the built-in bitwise operators
    ' when given operands in the range 0, 1, ..., 255.

    Dim intTrial As Integer
    For intTrial = 1 To 6

        Select Case intTrial
            Case 1
                Debug.Print "Not: ";
            Case 2
                Debug.Print "And: ";
            Case 3
                Debug.Print "Eqv: ";
            Case 4
                Debug.Print "Imp: ";
            Case 5
                Debug.Print "Or:  ";
            Case 6
                Debug.Print "Xor: ";
        End Select

        DebugTimerOn
    
        Dim varMin As Variant
        Dim varMax As Variant
        varMin = Null
        varMax = Null
    
        Dim intOne As Integer
        For intOne = 0 To 255
            Dim intTwo As Integer
            For intTwo = 0 To 255
                Dim varRes As Variant

                Select Case intTrial
                    Case 1
                        varRes = Not intOne
                    Case 2
                        varRes = intOne And intTwo
                    Case 3
                        varRes = intOne Eqv intTwo
                    Case 4
                        varRes = intOne Imp intTwo
                    Case 5
                        varRes = intOne Or intTwo
                    Case 6
                        varRes = intOne Xor intTwo
                End Select

                If varRes < varMin Or IsNull(varMin) Then varMin = varRes
                If varRes > varMax Or IsNull(varMax) Then varMax = varRes
            Next intTwo
        Next intOne
    
        Debug.Print varMin & "..." & varMax & " ";
    
        Debug.Print DebugTimerOff

    Next intTrial
End Sub

Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.