I have been programmer for a long a time. I was also introduced about the shifting of bytes (left and right) a long time ago but never really used it.
Can you guys give some application or usage of this? Thanks!
Printable View
I have been programmer for a long a time. I was also introduced about the shifting of bytes (left and right) a long time ago but never really used it.
Can you guys give some application or usage of this? Thanks!
Moved from "Contest Entries" forum
Shift left is * 2. Shift right is /2. And that's only a trivial usage. You can shift bits into a byte from a bit-banger (single bit) port to receive serial data. There are probably about another hundred uses I just can't think of at the moment.
Sorry about that... Hehe. Just a miscommunication with my mouse.. :DQuote:
Originally Posted by si_the_geek
Thanks for the answer! At least it's a start. Please post again if you have thought of more.. Thanks again!Quote:
Originally Posted by Al42
Compound integers:
high byte to byte: (byte) short >> 8
two bytes to short:
(short) = (highByte << 8) & lowByte
Etc.