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(-)