John Naylor <john.nay...@2ndquadrant.com> writes: > On Fri, Dec 27, 2019 at 9:54 AM Tom Lane <t...@sss.pgh.pa.us> wrote: >> ... but couldn't the >> right shift be elided in favor of changing the constant we >> subtract clz's result from? Shifting off those bits separately >> made sense in the old implementation, but assuming that CLZ is >> more or less constant-time, it doesn't with CLZ.
> That makes sense -- I'll look into doing that. Actually, we could apply that insight to both code paths. In the existing path, that requires assuming ALLOCSET_NUM_FREELISTS+ALLOC_MINBITS <= 17, but that's OK. (Nowadays I'd probably add a StaticAssert about that.) regards, tom lane