I am assuming that you want to Xor
the boolean values and not the binary representations of the integers themselves. So my answer is based on that assumption.
If you are using 1 for True
and 2 for False
, then I would suggest that you write some conversion functions.
Private Function IntegerToBoolean(number As Integer) As Boolean
Return If(number = 1, True, False)
End Function
Private Function BooleanToInteger(bool As Boolean) As Integer
Return If(bool, 1, 2)
End Function
then, using those, it's fairly trivial to write your other functions:
Private Function IntegerXor(int1 As Integer, int2 As Integer) As Integer
Dim bool1 As Boolean = IntegerToBoolean(int1)
Dim bool2 As Boolean = IntegerToBoolean(int2)
Dim boolResult as Boolean = (bool1 Xor bool2)
Return BooleanToInteger(boolResult)
End Function
etc.
Obviously you would do this for each of your numbers in your table, and you would create additional functions for And
and Or
.