|
-
March 7th, 2010, 10:44 PM
#5
Re: * 8 vs << 3
This is just basically echoing what others have said, but unless the context is in an embedded system, or you're explicitly doing bitwise operations, I would prioritize code clarity above all. In embedded system context, I would use the shifting explicitly only because I am not 100% confident I can trust the compiler to optimize as it should, so I'm not taking any chances since I want this code to be as open platform as possible. In the end, though, if we're talking a high-level system context it shouldn't matter for speed, even if for some strange reason the compiler *didn't* optimize, in which case, my coding standard is always to prefer clarity (here again though, bit shifting can actually provide better clarity depending on the context). So to be more concise: bit-shifting for the sake of bit-shifting I would not accept.
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
|