Name: [1836] Neil Dickson
Member: 84 months
Authored: 10 videos
Description: Hi, I'm a performance optimization enthusiast with an interest for many sorts of tough challenges. I've started Code Cortex, a group working to make software performance easier to improve. My sites are: http://www.neildickson.com/ http://www.codecortex.com/ ...

Performance Optimization Tutorial: Episode 2: Bits and Bytes, Part 1 [ID:1623] (3/3)

in series: Performance Optimization Tutorial

video tutorial by Neil Dickson, added 09/09

(Showmedo is undergoing major changes. To report any problems viewing the videos please email us and include browser and OS specifics. Cheers - Kyran.)

This video begins looking at available bit operations and what they do.

NOT, OR, AND, XOR, and TEST are examined, allowing us to set, reset, complement, and check individual bits, among a few other things. Next episode will examine operations related to bit-shifting and have our first experiment of the tutorial.

Got any questions?

Get answers in the ShowMeDo Learners Google Group.

Video statistics:

  • Video's rank shown in the most popular listing
  • Video plays: 302 (since July 30th)
  • Plays in last week: 0
  • Published: 59 months ago

Thank-yous, questions and comments

If this video tutorial was helpful please take some time to say thank-you to the authors for their hard work. Feel free to ask questions. Let the author know why their video tutorial was useful - what are you learning about? Did the video tutorial save you time? Would you like to see more?

You may also want to see our ShowMeDo Google Group to speak to our active users and authors.

Your email address will not be published.

Show some quick comments >>








All comments excluding tick-boxed quick-comments

4. anonymous Fri, 09 Oct 2009 10:56

Very cool! I liked the puns and the information was great :D Keep 'em comin'!

Christopher


Thanks. The confusion was with the total number of inputs being used (with whatever value), but it was rather the the number of values(set, or cleared) being odd or even to determine the result.


Sorry about the confusion; the sentence got pretty long so the meaning might've gotten lost. Some examples to clarify and elaborate:

0 xor 1 has an odd number (i.e. 1) of inputs that are ones, so the output is 1.

If you have a 3-way XOR gate, the value of xor(0,1,1) is 0, since it has an even number (i.e. 2) of ones, but xor(0,0,1) is 1, since it has an odd number (i.e. 1) of ones.

If you had a 10-way XOR gate, xor(1,0,0,1,1,0,1,0,0,1) is 1, since it has an odd number (i.e. 5) of ones.

In a different context, suppose that you have an array of dwords where every value is duplicated an even number of times except one value, which is duplicated an odd number of times. If you XOR all of the values together, the final result will be the value that's duplicated an odd number of times; this follows from that XOR is commutative (a XOR b = b XOR a) and nilpotent (a XOR a = 0).

I think we'll mostly just be using XOR for stuff like zeroing registers and negating floating-point numbers, but hopefully this helps give a bit better insight into XOR. :)


I got confused with the definition of XOR, because:

odd number of inputs set(to one) results in 1, else 0

But having 0 xor 1 results in 1, where it is a even number inputs and also not all are set(to one), which forms part of the else part of the previous sentence (resulting in 0)


Showmedo is a peer-produced video-tutorials and screencasts site for free and open-source software (FOSS)- with the exception of some club videos, the large majority are free to watch and download.

how to help » about » faq »

Educating the Open-source Community With Showmedo

Although as important as the software it supports, education and documentation are relatively neglected in the Open-source world. Coders love to code, and explaining how best to use or improve the software tends to be deferred or even sidelined.

At Showmedo we believe the community can play a vital role here and also say thanks for the tools and software that make our lives easier. If you have a piece of software you love or a programming langugage you are enthusiastic about, why not make a screencast showing others how to use it? All the stuff you wish you'd been told, the tips, tricks, insights that would have saved you time and frustration.

Screencasting is easier than you think, and we're happy to help you. You can emailus for advice or just use some of the how-to screencasts on the site. This screencasting learning-pathis a good place to start.

Kudos and Thanks for Neil

By the Same Author

Content

Feedback

Showmedo's development is fairly rapid and bugs will inevitably creep in. If you have any problems please drop us a line using the contact address below. Likewise, any suggestions for improvements to the site are gratefully received.

feedback@showmedo.com