pgsql: Fix portability issues in pg_bitutils

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix portability issues in pg_bitutils
Date: 2019-02-13 23:13:27
Message-ID: E1gu3iZ-000223-K9@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix portability issues in pg_bitutils

We were using uint64 function arguments as "long int" arguments to
compiler builtins, which fails on machines where long ints are 32 bits:
the upper half of the uint64 was being ignored. Fix by using the "ll"
builtin variants instead, which on those machines take 64 bit arguments.

Also, remove configure tests for __builtin_popcountl() (as well as
"long" variants for ctz and clz): the theory here is that any compiler
version will provide all widths or none, so one test suffices. Were
this theory to be wrong, we'd have to add tests for
__builtin_popcountll() and friends, which would be tedious.

Per failures in buildfarm member lapwing and ensuing discussion.

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/109de05cbb034b032cd60f50708716c8ff0afdf2

Modified Files
--------------
config/c-compiler.m4 | 58 ----------------
configure | 152 +++++++++++-------------------------------
configure.in | 7 +-
src/include/pg_config.h.in | 21 ++----
src/include/pg_config.h.win32 | 21 ++----
src/port/pg_bitutils.c | 73 ++++++++++----------
6 files changed, 87 insertions(+), 245 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2019-02-14 15:52:08 pgsql: Move pattern selectivity code from selfuncs.c to like_support.c.
Previous Message Andrew Gierth 2019-02-13 22:16:49 Re: pgsql: Change floating-point output format for improved performance.