Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I don't use C++ or bitwise operations at my current job but I'm thinking of applying to companies where it is a requirement to be fluent with them (on their tests anyway).

So my question is: Can anyone suggest a project which will require gaining a fluency in bitwise operations to complete?

On a side note, is there a canonical book on optimization techniques using bitwise operations since that seems to be an important use of them?

share|improve this question
    
(1) Understand all the two operand truth tables (and how to construct each of them out of just 'and', 'or', and 'not' combinations), (2) be able to count in gray code if necessary, (3) optimize the logic with a Karnaugh map –  MichaelT Nov 29 '12 at 16:45
add comment

closed as not constructive by Oded, gnat, Yusubov, Walter, Blrfl Nov 29 '12 at 16:02

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

2 Answers

up vote 1 down vote accepted

There's no mystery to bitwise operations. Perhaps you're thinking of some of the crazy bit twiddling tricks that people have come up with over the years? For example, Stanford has a page with a long list of such tricks. Your best bet there is to just start with a list such as the one I linked and go through a number of them. Step through them in a debugger if it helps. Once you understand a handful of them, you'll get more comfortable thinking in those terms.

share|improve this answer
    
Thanks! That is exactly the kind of information I was looking for, I just didn't know the precise terminology. –  Ford Nov 29 '12 at 16:41
add comment

You'd hardly need a book to figure this out, only to know how numbers are represented in binary. Buy yourself a pad and pencil and draw some Truth Tables

As for a project, how about writing an algorithm that takes an image bitmap and draws/blits it transparently onto another image using masks. Allow the user to select the transparent colour.

share|improve this answer
    
Do truth tables help you figure out the practical applications of bitwise operations or optimization techniques in C++? –  Ford Nov 29 '12 at 15:52
    
Practical yes, language agnostic, what optimisation techniques are you referring to? –  James Nov 29 '12 at 16:13
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.