I have written lines of code with mathematical operators...but i always wonder about shiFters (Shift Operators...Bingo!)...
Why do we need it...? watz the use...? Read on...
1. Make faster integer division/multiplication operations:

4839534 * 4
can be done like this:
4839534 << 2


543894 / 2
can be done like this:
543894 >> 1

Shift operations much more faster than multiplication for most of processors.

2. Reassembling byte streams to int values
3. For accelerating operations with graphics since Red, Green and Blue colors coded by separate bytes.
4. Packing small numbers into one single long...

No comments: