Thread: Shifting Bytes
View Single Post
Old Dec 15th, 2006, 5:35 PM   #4
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Well, you shift all the bits at once, just one position at a time. It isn't that inefficient. It's a binary divide by two. You could always just pick up the byte and sling it next door, then do whatever you want with its original home. If you want to work with things that don't conform to available boundaries, then you're going to get into masking and combining and all that hooraw.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote