2

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?

  • (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 – user40980 Nov 29 '12 at 16:45
2

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.

  • Thanks! That is exactly the kind of information I was looking for, I just didn't know the precise terminology. – fordeka Nov 29 '12 at 16:41
2

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.

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

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