Support fls().
authorRobert Haas <[email protected]>
Tue, 7 Feb 2012 18:45:46 +0000 (13:45 -0500)
committerRobert Haas <[email protected]>
Tue, 7 Feb 2012 18:45:46 +0000 (13:45 -0500)
commit4f658dc851a73fc309a61be2503c29ed78a1592e
tree62c0e1e7bb4eb3d36313ced39615c6cda9acde11
parentf7d7dade8afe19847510efe44be191c35e1ce26c
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.
configure
configure.in
src/include/pg_config.h.in
src/include/port.h
src/port/fls.c [new file with mode: 0644]