summaryrefslogtreecommitdiff
path: root/src/backend/access/gist/gistxlog.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2019-12-28 17:21:17 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2019-12-28 17:21:17 -0500
commit0ce38730ac72029f3f2c95ae80b44f5b9060cbcc (patch)
treef240f28237136dae4a3e046c2a3a190c694f9241 /src/backend/access/gist/gistxlog.c
parent27a3b2ad836c9e7dd243bfebc760a9df9d6fd5a3 (diff)
downloadpostgresql-0ce38730ac72029f3f2c95ae80b44f5b9060cbcc.tar.gz
Micro-optimize AllocSetFreeIndex() by reference to pg_bitutils code.
Use __builtin_clz() where available. Where it isn't, we can still win a little by using the pg_leftmost_one_pos[] lookup table instead of having a private table. Also drop the initial right shift by ALLOC_MINBITS in favor of subtracting ALLOC_MINBITS from the leftmost-one-pos result. This is a win because the compiler can fold that adjustment into other constants it'd have to add anyway, making the shift-removal free. Also, we can explain this coding as an unrolled form of pg_leftmost_one_pos32(), even though that's a bit ahistorical since it long predates pg_bitutils.h. John Naylor, with some cosmetic adjustments by me Discussion: https://postgr.es/m/CACPNZCuNUGMxjK7WTn_=WZnRbfASDdBxmjsVf2+m9MdmeNw_sg@mail.gmail.com
Diffstat (limited to 'src/backend/access/gist/gistxlog.c')
0 files changed, 0 insertions, 0 deletions