[comp.lang.c] <<

chris@mimsy.UUCP (Chris Torek) (11/10/88)

In article <339@igor.Rational.COM> dsb@Rational.COM (David S. Bakin) writes:
>[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@quintus.uucp???]

I have no idea why that happened.

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

Were it defined that way, that would be the case.  But (as a concession
to weird machines like the VAX, and all those others that also `happen'
to use just low order bits) the dpANS defines << such that the VAX ASHL
instruction can be used, and so you can expect that the ASHL instruction
*will* be used (even on other machines); and so you should beware of
shifting integers by too many bits.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris@mimsy.umd.edu	Path:	uunet!mimsy!chris