Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gu9rJ-0005JR-Ro for pgsql-hackers@arkaria.postgresql.org; Thu, 14 Feb 2019 05:46:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gu9rI-0002g8-Lm for pgsql-hackers@arkaria.postgresql.org; Thu, 14 Feb 2019 05:46:52 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gu9rI-0002g1-5h for pgsql-hackers@lists.postgresql.org; Thu, 14 Feb 2019 05:46:52 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gu9rE-0004fz-Ew for pgsql-hackers@lists.postgresql.org; Thu, 14 Feb 2019 05:46:49 +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 x1E5kghH017613; Thu, 14 Feb 2019 00:46:42 -0500 From: Tom Lane To: Gavin Flower cc: pgsql-hackers@lists.postgresql.org Subject: Re: Using POPCNT and other advanced bit manipulation instructions In-reply-to: <7cd3ffa8-4889-1188-4baa-80ac4396be54@archidevsys.co.nz> References: <20190213221719.GA15976@alvherre.pgsql> <7cd3ffa8-4889-1188-4baa-80ac4396be54@archidevsys.co.nz> Comments: In-reply-to Gavin Flower message dated "Thu, 14 Feb 2019 18:29:24 +1300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <17611.1550123202.1@sss.pgh.pa.us> Date: Thu, 14 Feb 2019 00:46:42 -0500 Message-ID: <17612.1550123202@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Gavin Flower writes: > From my memory of reading of K&R many moons ago, it said that C only > guarantees that the lengths are such that > byte <= half word <= word <= long Indeed. > But I don't recall ever seeing a long less than 32 bits! I'm not sure offhand what C89 said, but C99 requires "short" to be at least 16 bits, "long" to be at least 32 bits, and "long long" to be at least 64; see the minimum allowed values for SHRT_MAX etc. C99 does permit "int" to be only 16 bits, but Postgres doesn't pretend to work on such an architecture, and nobody's made one since the (early?) 90s. regards, tom lane