Robert Haas <robertmh...@gmail.com> 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?

Yes.

                        regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to