Re: 64 bitshift bug



I should have known better than this.  'collected' used to be a 32bit
integer so I forgot to make the change when I switched it to 64.

Please tell me that you weren't actually bitten by this bug...  If you
were, then I have a good deal of sympathy for your parser :)

Note that we have G_GUINT64_CONSTANT () exactly for this purpose....

Thanks for the good catch.

Cheers

On Wed, 2008-01-02 at 02:06 +0100, Lieven van der Heide wrote:
> Hi,
> 
> In gmarkup.c, there's this line:
> 
> if ((collected & (1 << i)) == 0)
> 
> collected is a 64 bit integer, but 1 << i results in a 32 bit integer,
> which is then converted to 64 bits, for the & operator.
> 
> I assume we just want to test any of the 64 bits, using an index in i,
> in which case it should be:
> 
> if ((collected & ((guint64)1 << i)) == 0)
> 
> I attached a patch that fixes it.
> 
> Greets,
> 
> Lieven van der Heide.
> _______________________________________________
> gtk-devel-list mailing list
> gtk-devel-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-devel-list



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]