Regarding Left shift operator in embedded processor

Jan 12, 2005 21 Replies

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

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 --

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required