Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Namespace Network
- Public Class BooleanByteWrapper
- Public Shared Sub SetFlag(ByRef target As Byte, ByVal rank As Integer, ByVal value As Boolean)
- Dim array As New BitArray(New Byte() {target})
- array.Item(rank) = value
- Dim num As Byte = 0
- Dim i As Byte = 0
- Do While (i < array.Count)
- num = CByte((num Or If(array.Item(i), CByte((CInt(1) << i)), CByte(0))))
- i = CByte((i + 1))
- Loop
- target = num
- End Sub
- Public Shared Function GetFlag(ByVal target As Byte, ByVal rank As Integer) As Boolean
- Dim array As New BitArray(New Byte() {target})
- Return array.Get(rank)
- End Function
- End Class
- End Namespace
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement