pgsql: Support fls().

From: Robert Haas <rhaas(at)postgresql(dot)org>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Support fls().
Date: 2012-02-07 18:57:30
Message-ID: E1RuqEM-0002nE-Pf@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Support fls().

The immediate impetus for this is that Noah Misch's patch to elide
unnecessary table and index rebuilds when changing typmod for temporal
types uses it; and this is extracted from that patch, with some
further commentary by me. But it seems logically separate from the
remainder of the patch, so I'm committing it separately; this is not
the first time someone has wanted fls() in the backend and probably
won't be the last.

If we end up using this in more performance-critical spots it may be
worthwhile to add some architecture-specific optimizations to our
src/port version of fls() - e.g. any x86 platform can implement this
using the assembly instruction BSRL. But performance won't matter
a bit for assessing typmod changes, so I'm not worried about that
right now.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/4f658dc851a73fc309a61be2503c29ed78a1592e

Modified Files
--------------
configure | 3 +-
configure.in | 2 +-
src/include/pg_config.h.in | 3 ++
src/include/port.h | 4 +++
src/port/fls.c | 64 ++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 74 insertions(+), 2 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Heikki Linnakangas 2012-02-07 19:22:09 pgsql: Fix typo in comment.
Previous Message Robert Haas 2012-02-07 17:43:09 pgsql: Add a transform function for varbit typmod coercisions.