B
barbara
Hi, all
I have to read a binary data which is four bytes and I need to use the
following function to deal with data:
Private Function BIT(ByVal Val As UInt32, ByVal BitNum As UInt32) As
UInt32
Dim displayMask As UInt32 = Convert.ToUInt32(1)
If (BitNum = Convert.ToUInt32(0)) Then
If ((Val And displayMask) = 1) Then
Return Convert.ToUInt32(1)
Else
Return Convert.ToUInt32(0)
End If
Else
Val = shiftRight(Val, BitNum)
If ((Val And displayMask) = 1) Then
Return Convert.ToUInt32(1)
Else
Return Convert.ToUInt32(0)
End If
End If
End Function
but I got error like "Operator 'And' or '=' is not defined for types
'System.uint32".
How to make it work?
Thanks!
I have to read a binary data which is four bytes and I need to use the
following function to deal with data:
Private Function BIT(ByVal Val As UInt32, ByVal BitNum As UInt32) As
UInt32
Dim displayMask As UInt32 = Convert.ToUInt32(1)
If (BitNum = Convert.ToUInt32(0)) Then
If ((Val And displayMask) = 1) Then
Return Convert.ToUInt32(1)
Else
Return Convert.ToUInt32(0)
End If
Else
Val = shiftRight(Val, BitNum)
If ((Val And displayMask) = 1) Then
Return Convert.ToUInt32(1)
Else
Return Convert.ToUInt32(0)
End If
End If
End Function
but I got error like "Operator 'And' or '=' is not defined for types
'System.uint32".
How to make it work?
Thanks!