pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Gavin Flower <GavinFlower@archidevsys.co.nz>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: Using POPCNT and other advanced bit manipulation instructions
Date: Thu, 14 Feb 2019 00:46:42 -0500
Message-ID: <17612.1550123202@sss.pgh.pa.us> (raw)
In-Reply-To: <7cd3ffa8-4889-1188-4baa-80ac4396be54@archidevsys.co.nz>
References: <20190213221719.GA15976@alvherre.pgsql>
	<7cd3ffa8-4889-1188-4baa-80ac4396be54@archidevsys.co.nz>

Gavin Flower <GavinFlower@archidevsys.co.nz> 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




view thread (49+ messages)  latest in thread

Message-ID: <17612.1550123202@sss.pgh.pa.us>
Permalink:  ../17612.1550123202@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/17612.1550123202@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, GavinFlower@archidevsys.co.nz, pgsql-hackers@lists.postgresql.org
  Subject: Re: Using POPCNT and other advanced bit manipulation instructions
  In-Reply-To: <17612.1550123202@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox