Here is a nice set of functions to do your bit manipulation in C#:
http://codeidol.com/community/dotnet/turning-bits-on-or-off/8901/
Here they are in VB.NET:
Public Function TurnBitOn(value As Integer, bitToTurnOn As Integer) As Integer Return (value Or bitToTurnOn)
End Function
End Function
Public Function TurnBitOff(value As Integer, bitToTurnOff As Integer) As Integer Return (value And Not bitToTurnOff)
End Function
End Function
End Function
End Function
End Function
No comments:
Post a Comment