On Tue, Dec 18, 2018 at 9:46 AM Tom Lane <t...@sss.pgh.pa.us> wrote: > Alvaro Herrera <alvhe...@2ndquadrant.com> writes: > > On the other hand, I'm not clear on why do we need four copies of > > number_of_ones. > > Yeah, it might be time to move something like that into a common > location. Not sure where the threshold of pain is, though.
Yeah. I think we need bitutils.c as discussed here: https://www.postgresql.org/message-id/flat/CAEepm%3D3k%2B%2BYtf2LNQCvpP6m1%3DgY9zZHP_cfnn47%3DWTsoCrLCvA%40mail.gmail.com I sort of foundered on the the difficulty of using popcnt and bitscan/log2 instructions/builtins without putting a runtime test and a honking great function pointer in front of them. +1 for at least deduplicating all these implementations as discussed in that thread. -- Thomas Munro http://www.enterprisedb.com