Regarding Left shift operator in embedded processor - Page 2

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
Re: Regarding Left shift operator in embedded processor

Quoted text here. Click to load it
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
We've slightly trimmed the long signature. Click to see the full one.
Re: Regarding Left shift operator in embedded processor

Quoted text here. Click to load it
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<<8) to a byte, for any n, will give zero.

Quoted text here. Click to load it


Site Timeline