diff options
author | Robert Haas <rhaas@postgresql.org> | 2012-02-07 13:45:46 -0500 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2012-02-07 13:45:46 -0500 |
commit | 4f658dc851a73fc309a61be2503c29ed78a1592e (patch) | |
tree | 62c0e1e7bb4eb3d36313ced39615c6cda9acde11 /src/include/port.h | |
parent | f7d7dade8afe19847510efe44be191c35e1ce26c (diff) | |
download | postgresql-4f658dc851a73fc309a61be2503c29ed78a1592e.tar.gz postgresql-4f658dc851a73fc309a61be2503c29ed78a1592e.zip |
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.
Diffstat (limited to 'src/include/port.h')
-rw-r--r-- | src/include/port.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/include/port.h b/src/include/port.h index bec40c11612..a5e80211b41 100644 --- a/src/include/port.h +++ b/src/include/port.h @@ -396,6 +396,10 @@ extern double pg_erand48(unsigned short xseed[3]); extern long pg_lrand48(void); extern void pg_srand48(long seed); +#ifndef HAVE_FLS +extern int fls(int mask); +#endif + #ifndef HAVE_FSEEKO #define fseeko(a, b, c) fseek(a, b, c) #define ftello(a) ftell(a) |