Robert Haas <> writes:
> Hmm, I'm not sure I understand that warning.  I think the complaint is
> about this line of code:

>         Size        threshold = 1 << (bin - 1);

> "bin" is declared as "Size", and threshold is also declared as "Size",
> so what's the problem?

The shift operator does not coerce its operands to be the same size.
It just shifts the left operand in its native width, which here is
"int", which ain't enough.

> (Size) 1 << (bin - 1) would be safer?


                        regards, tom lane

Sent via pgsql-hackers mailing list (
To make changes to your subscription:

Reply via email to