bug?

Alexandre Oliva aoliva@redhat.com
Tue Jun 19 00:31:00 GMT 2001


On Jun 19, 2001, Ingo Krabbe <ikrabbe@earthling.net> wrote:

> On 19 Jun 2001, Alexandre Oliva wrote:

>> This is only well-defined if x's type is unsigned.  The behavior of
>> right-shifting negative values is undefined (or unspecified?)

> That's a kind of why I used ~(~(x^x)<<(sizeof(x)*8-n)).

Make the `8' `CHAR_BIT'.  BTW, did you consider what happens if x is
narrower than size_t (the type of sizeof(x)) for both signed and
unsigned integer types?

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me



More information about the Gcc-help mailing list