signed/unsigned right shift
Andreas Schwab
schwab@suse.de
Fri Mar 12 22:24:00 GMT 2004
Christian Groessler <cpg@aladdin.de> writes:
> I have the following program which takes 2 unsigned short values,
> multiplies them and shifts the result right.
>
> This right shift gives a value with 1s bits at the high end.
This is correct. The promotion rules let unsigned short promote to int,
since the latter can represent all values of the former.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, MaxfeldstraÃe 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
More information about the Gcc
mailing list