"for" loops in C ...

Guy Harris guy at auspex.UUCP
Thu Nov 10 04:23:49 AEST 1988


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

More precisely, "<<" is defined as a left shift that does unspecified
things if the shift count is larger than the size of the (appropriately
promoted) left-hand operand.  Thus, the single VAX ASHL instruction
implements what various language specs say "<<" means, and a left-shift
instruction that *didn't* mask the shift count would also do so.



More information about the Comp.lang.c mailing list