[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [gnugo-devel] sign bit bit shift issue
From: |
dave . denholm |
Subject: |
Re: [gnugo-devel] sign bit bit shift issue |
Date: |
10 Feb 2003 18:59:29 +0000 |
Arend Bayer <address@hidden> writes:
> Hellwig wrote:
>
> > On 08-Feb-03 Arend Bayer wrote:
> > >
> > > According to the C standard, the patch below fixes a bug. Rotating into
> > > the sign bit of a signed integer is undefined.
> > >
> > > Does anyone happen to know whether this is a problem in real world?
> > > (I.e. do there exist platforms where (1 << 31 == 0x8000000) does not
> > > hold true?)
> >
> This seems to say clearly that 1 << 31 is undefined for 32bit ints.
>
Probably no less defined than
(signed int)(1U << 31)
ie setting bit 31 in an unsigned int, then casting to signed
[
Are the quantities concerned naturally signed ? If bit shifting is
going on, perhaps everything should be unsigned anyway ?
]
dd
--
address@hidden http://www.insignia.com