"for" loops in C ...
David S. Bakin
dsb at Rational.COM
Wed Nov 9 05:19:04 AEST 1988
[What's going on? The article I'm replying to was signed by Chris Torek of
uunet!mimsy!chris but the headers say it is from ok at quintus.uucp???]
In article <645 at quintus.UUCP>, ok at quintus (Richard A. O'Keefe) writes:
>In article <192 at libove.UUCP> root at libove.UUCP (Jay M. Libove) writes:
>>Looking at the above, I read it to be "shift an n-bit integer n bits left"
>>... Now, why is there any question as to the result?
>
>Because different machines implement shift-left differently.
>
> ... [omitted]
>
>On the VAX, the result of shifting by the (not known to be constant)
>value 32 is the same as the result of shifting by zero, because the VAX
>looks only at the 5 lowest order bits of the shift count. It does this
>so that right shifts can be done with negative left shifts.
>--
>In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
>Domain: chris at mimsy.umd.edu Path: uunet!mimsy!chris
I don't get it. The operator << is defined in C as a left shift, what
does that have to do with a particular VAX instruction, ASHL, that happens
to mask its operand to the low-order 5 bits. Doesn't this merely mean that
on the VAX when the argument of the left shift is not a known constant that
the single instruction ASH sequence must be replaced by a multiple instruction
sequence that does the right thing?
-- Dave
----------------------------------------------------------
Dave Bakin (408) 496-3600
c/o Rational; 3320 Scott Blvd.; Santa Clara, CA 95054-3197
Internet: dsb at rational.com Uucp: ...!uunet!igor!dsb
More information about the Comp.lang.c
mailing list