Right shift vs. divide
Barry Shein
bzs at bu-cs.UUCP
Tue Dec 24 08:35:13 AEST 1985
>BTW, is >> defined to be a sign-extended shift or a zero extended shift
>and under what circumstances.
>
> Paul
> Schauble @ MIT-Multics
It should be controlled by the types of the things being shifted,
not the operator:
int foo, bar ;
unsigned int thing, stuff ;
foo = foo >> bar ;
thing = thing >> stuff ;
Expect the former to generate signed shift and the latter to generate
an unsigned, casts are often useful to accomplish this.
-Barry Shein, Boston University
More information about the Comp.lang.c
mailing list