64 bitshift bug


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.


Lieven van der Heide.

Attachment: 64bit bitshift.patch
Description: Binary data

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