Re: bitwise operations
- From: alantolan@xxxxxxxxx
- Date: 10 Aug 2005 09:10:04 -0700
>I am looking for a sample of code that sets and reads individual bits within an Integer
The AND, OR and NOT operators are used for both logical and bitwise
operations in VB.
To turn a specific bit on, use OR
&H1000 OR &H0001 = &H1001
To turn a specfic bit off, use AND and NOT
&H1001 AND NOT &H0001 = &H1000
To ascertain if a specific bit is turned on, use AND and check the
result against 0
&H1000 AND &H0001 = &H0000 => not on
&H1001 AND &H0001 = &H0001 => is on.
hth,
Alan.
.
- References:
- bitwise operations
- From: S Shulman
- bitwise operations
- Prev by Date: Re: Data transfer to portable.
- Next by Date: Re: Data transfer to portable.
- Previous by thread: bitwise operations
- Next by thread: Data transfer to portable.
- Index(es):
Relevant Pages
|