|
-
Apr 13th, 2006, 08:22 AM
#1
Thread Starter
Addicted Member
What is use of Shift Left/Right?
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!
-
Apr 13th, 2006, 07:48 PM
#2
Re: What is use of Shift Left/Right?
Moved from "Contest Entries" forum
-
Apr 13th, 2006, 09:40 PM
#3
Re: What is use of Shift Left/Right?
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.
-
Apr 14th, 2006, 05:21 AM
#4
Thread Starter
Addicted Member
Re: What is use of Shift Left/Right?
 Originally Posted by si_the_geek
Moved from "Contest Entries" forum
Sorry about that... Hehe. Just a miscommunication with my mouse..
-
Apr 14th, 2006, 05:26 AM
#5
Thread Starter
Addicted Member
Re: What is use of Shift Left/Right?
 Originally Posted by Al42
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.
Thanks for the answer! At least it's a start. Please post again if you have thought of more.. Thanks again!
-
Apr 25th, 2006, 09:43 PM
#6
Re: What is use of Shift Left/Right?
Compound integers:
high byte to byte: (byte) short >> 8
two bytes to short:
(short) = (highByte << 8) & lowByte
Etc.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|