Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cDv11-0005pp-HY for pgsql-hackers@arkaria.postgresql.org; Mon, 05 Dec 2016 15:17:15 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cDv10-000480-P6 for pgsql-hackers@arkaria.postgresql.org; Mon, 05 Dec 2016 15:17:14 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cDv10-00047j-1n for pgsql-hackers@postgresql.org; Mon, 05 Dec 2016 15:17:14 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cDv0t-0006uY-35 for pgsql-hackers@postgresql.org; Mon, 05 Dec 2016 15:17:13 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id uB5FH4u2032389; Mon, 5 Dec 2016 10:17:04 -0500 From: Tom Lane To: Robert Haas cc: Michael Paquier , PostgreSQL mailing lists Subject: Re: [COMMITTERS] pgsql: Introduce dynamic shared memory areas. In-reply-to: References: Comments: In-reply-to Robert Haas message dated "Mon, 05 Dec 2016 10:09:28 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <32387.1480951024.1@sss.pgh.pa.us> Date: Mon, 05 Dec 2016 10:17:04 -0500 Message-ID: <32388.1480951024@sss.pgh.pa.us> X-Pg-Spam-Score: -4.9 (----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org 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? 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