Regarding Left shift operator in embedded processor

Unless you want to shift a byte left by a variable amount, and zero is the correct answer if you're shifting by eight. Then you either need to hope that your platform just uses a shift-left instruction (giving you zero), or you have to add a test (consuming expensive clock ticks).

--

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com
Reply to
Tim Wescott
Loading thread data ...

constant

out

extraneous

is

to

you

No, C will *never* give zero as an (intermediate) answer, due to its promotion rules as explained by other posters. Of course *assigning* (n --

Reply to
toby

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.