Sub SetBit(b As Int, index As Int, on As Boolean) As Int
If on Then
Return Bit.Or(b, Bit.ShiftLeft(1, index))
Else
Return Bit.And(b, Bit.Not(Bit.ShiftLeft(1, index)))
End If
End Sub
Sub GetBit(b As Byte, index As Int) As Boolean
Dim t As Byte = Bit.ShiftLeft(1, index)
Return Bit.And(b, t) = t
End Sub