Jan 30, 2012
As we have seen before, the power of bitwise operators are immense. Sometimes thinking in terms of arithmetical operators cost you lots of CPU time when compared to bitwise operators. So given a problem its obvious for us to think in terms of arithmetical solutions, but try to search for a bitwise solution and compare it with previous one. You can end up in a very powerful algorithm too. Now I wish to share one such case where the use of bitwise operator avoids the use of a loop too.
Read more...Jul 23, 2011
“There are 10 kind of people, One who knows Binary and the other who doesn’t.”
In the earlier days when electronic computers was first built, inputs were given in binary using tapes and outputs were also obtained as binary. So then, the people who where using the computers had to know binary ’language’. But now, we have GBs of movies, pictures, audio, documents, text and more & more type of files that we even we couldn’t make a full list of. Do we ever know how 0s and 1s formed these things? At the least, when we start to work with Bitwise operators we should have the knowledge of how these media are represented by the binary language. In this article we will see how to does binary works with numbers and text.
Read more...Jul 12, 2011
I suddenly got an example that may help you remember the characteristics of AND, OR, NOT and XOR. Consider them as four different human individuals, with four different characteristics or behavior. Humans generally have the behavior of conveying things different from what they really heard; they may add something to the original story or hide something or even tell opposite of what happened. We have had lots of acquaintances with situations like this which would make this example unforgettable I think. Our men, AND, OR, NOT and XOR are no exception to these characters but each one having a different unique character.
Read more...Jul 10, 2011
‘Bitwise operators’, as the name says they are indeed wise enough to do anything that a computer can do. In computer architecture, we would have studied how these ANDs, ORs and SHIFTs are used to do any mathematical operation. Any basic arithmetic operation is a set of bitwise operation, which for convenience we have abstracted to a level that we forgot what is underlying. Sometimes, a lower level of abstraction is a better tradeoff to higher level of abstraction; an example is that programs written in assembly language are more efficient than those written in high level language. So we have to pierce through the abstraction to find the right things when we really need right things. Well, I think it is time to learn some bitwise tricks and improve our programming. Presence of bitwise operators in your programs identifies yourself as a quality programmer from my point.
Read more...