This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: portable signed right shift
- To: gcc at gcc dot gnu dot org, nbecker at fred dot net
- Subject: Re: portable signed right shift
- From: dewar at gnat dot com
- Date: Tue, 27 Mar 2001 16:46:07 -0500 (EST)
<<OK, great. So what is an efficient, portable way to get a signed
right shift?
>>
There isn't one, because there is not even a portable representation
for signed numbers. If you think you know the representation, then
you can always do the shift as an unsigned number.
That's the reason the standard does not define it. Note that this is
implementation defined, so it may well be that the definition from
the implementation corresponds to what you want, but clearly there
is no way to write standard portable C that is target independent
in this case!