Thomas Munro <thomas.mu...@gmail.com> writes: > Back in commit 4f658dc8 we gained src/port/fls.c. As anticipated by > its commit message, we later finished up with something better in > src/include/port/pg_bitutils.h. fls() ("find last set") is an > off-by-one cousin of pg_leftmost_one_pos32(). I don't know why ffs() > ("find first set", the rightmost variant) made it into POSIX while > fls() did not, other than perhaps its more amusing name. fls() is > present on *BSD, Macs and maybe more, but not everywhere, hence the > configure test. Let's just do it with pg_bitutils.h instead, and drop > some cruft? Open to better ideas on whether we need a new function,
I think we could probably just drop fls() entirely. It doesn't look to me like any of the existing callers expect a zero argument, so they could be converted to use pg_leftmost_one_pos32() pretty trivially. I don't see that fls() is buying us anything that is worth requiring readers to know yet another nonstandard function. regards, tom lane