Special

Clearance Sale!

We've been publishing for over five years now and it's time to clear out our inventory of back issues, so we're slashing prices!

RBD Magazines

Check out this amazing clearance sale of all our past issues. Missing some issues? This is a great time to complete your RBD collection. Save up to 40% off the regular price of our printed back issue packages. These prices are only good until the end of the year May 2008 and supplies are limited, so place your order today.

Article Preview


Buy Now

Print:
PDF:

Feature

Bitwise Operations for Noobs

Working with bits

Issue: 5.2 (January/February 2007)
Author: Aaron Ballman
Article Description: No description available.
Article Length (in bytes): 18,817
Starting Page Number: 26
RBD Number: 5210
Resource File(s):

Download Icon 5210.zip Updated: Monday, January 15, 2007 at 1:16 PM

Related Web Link(s):

http://en.wikipedia.org/wiki/Truth_table

Known Limitations: None

Excerpt of article text...

If you've done any programming with REALbasic before, then chances are pretty good that you've used logical (Boolean) operators before, such as And, Or, & Not. These operators provide you with a logical way to describe a Boolean process. For instance, you may have code which says:

If UserIsAuthorized and OperationIsPermitted then DoOperation( user, operation )

If not ActionFailed then Success( "yay!" )

If Cold or Mild then MsgBox( "It's not hot out" )

These operations read as easy as English and provide your control statements with logic (hence the reason they're called logical operators). However, there's a similar class of operations called Bitwise or Arithmetic operators. These operators are very similar to logical ones in that they provide a means for describing ways of combining two operands. However, instead of involving the Boolean logic of true and false, they involve the mathematical logic of ones and zeros.

You may be thinking to yourself, "But I hate math!" Don't worry! The beauty of the two concepts is that they're generally very closely related. You can map the logical term "true" to the mathematical value "1" and "false" to "0." The main difference between logical and bitwise operations is that with bitwise operators, you're not working with just one bit of information, but a string of bits.

...End of Excerpt. Please purchase the magazine to read the full article.

Article copyrighted by REALbasic Developer magazine. All rights reserved.


 


|

 


Weblog Commenting and Trackback by HaloScan.com