Speeding up your code with the Bitwise Operator (&)

While building a Flash game, I wrote some code to alternate through squares on a grid system and it seemed rather slow. My code made use of the % (modulo) operator and, thinking that was the cause, I went in search of a better solution. I blew the dust off the Bitwise operator (&) and researched what it actually does. As it turns out, this little bit of programming’s past can be quite handy.

Comments & corrections are always welcome and if you have any similiar tricks to share, I’d love to hear about them.

Like it? Share it

Share on LinkedIn

Share on Google Plus