On Thu, 25 May 2023, Jā‚‘ā‚™ā‚› Gustedt wrote: > Rich, > > on Wed, 24 May 2023 17:28:35 -0400 you (Rich Felker ) > wrote: > > > There's a more efficient implementation of this function which does > > not depend on __builtin_ctzll (which we don't): p^(p-1)&p > > yes, nice > > If you have other such nice formulas for some of the interfaces in > , please let me know. They are hard to find in search > engines. It seems this was unanswered. Hacker's Delight by Henry Warren offers a lot of material on such topics. For this particular question it also gives the efficient implementation: 'p & -p'. I looked over the recently posted stdbit.h patch and I don't have anything to suggest in terms of formulas. The things that would worry me are of a different nature anyway. Alexander