johnadonaldson
Well-known member
- Joined
- Nov 9, 2005
- Messages
- 48
- Programming Experience
- 10+
Can someone show the simple way to bit masking under VB.NET. I have regesters that I need to be able to determine which bit has been set and which has not. I tryed this but with mixed results
Dim nMask as Integer
Dim nResult as Integer
nMask = &H111
nResult = nMask AND nInput
if nResult = &h01 then
.......
else if nResult = &02 then
.......
I then need to change a single bit in a integer such as if bit 3 is a 0 then make it a 1 and not
affect the other bits.
Dim nMask as Integer
Dim nResult as Integer
nMask = &H111
nResult = nMask AND nInput
if nResult = &h01 then
.......
else if nResult = &02 then
.......
I then need to change a single bit in a integer such as if bit 3 is a 0 then make it a 1 and not
affect the other bits.