PC Review


Reply
Thread Tools Rate Thread

bitwise operations

 
 
S Shulman
Guest
Posts: n/a
 
      10th Aug 2005
Hi

I am looking for a sample of code that sets and reads individual bits within
an Integer

Thank you,
Shmuel Shulman
SBS Technologies LTD


 
Reply With Quote
 
 
 
 
alantolan@users.com
Guest
Posts: n/a
 
      10th Aug 2005
>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.

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
bitwise operations as in xor stevenshrii Microsoft Excel Misc 2 16th Apr 2009 09:43 AM
BitWise Operations =?Utf-8?B?Sm9u?= Microsoft ASP .NET 3 24th Jan 2006 09:19 AM
Bitwise operations AMDRIT Microsoft Dot NET 4 20th Jan 2006 10:20 PM
Bitwise Operations Christopher Weaver Microsoft C# .NET 9 18th Aug 2005 07:35 PM
Do I use 'or' for bitwise operations where in c# I use | ? Emilio Microsoft VB .NET 10 15th Oct 2004 09:34 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:18 AM.