GetBit and SetBit
this may help?
Sub GetBit(Bits As Int, BitNo As Int ) As Boolean
Return Bit.And(Bits,Power(2,(BitNo - 1)))/Power(2, (BitNo - 1))=1
End Sub
Sub SetBit(Bits As Int, BitNo As Int, Bstat As Boolean ) As Int
If Not(Bstat) Then
Bits = Bit.And(Bits,Bit.Not(Power(2, (BitNo - 1))))
Else
Bits = Bit.Or(Bits,Power(2, (BitNo - 1)))
End If
Return Bits
End Sub