Re: use CLZ instruction in AllocSetFreeIndex()

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: use CLZ instruction in AllocSetFreeIndex()
Дата
Msg-id 20191227162947.GA25500@alvherre.pgsql
обсуждение исходный текст
Ответ на Re: use CLZ instruction in AllocSetFreeIndex()  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: use CLZ instruction in AllocSetFreeIndex()  (David Fetter <david@fetter.org>)
Re: use CLZ instruction in AllocSetFreeIndex()  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On 2019-Dec-27, Tom Lane wrote:

> This kind of leads me to wonder if we don't need to expend more
> effort on the non-CLZ version of pg_leftmost_one_pos32; it seems
> like it shouldn't be losing this badly to the only-slightly-
> improved logic that's currently in AllocSetFreeIndex.  On the
> other hand, the buildfarm thinks that __builtin_clz is essentially
> universal these days --- the only active non-MSVC critter that
> reports not having it is anole.  So maybe it's not worth sweating
> over that.  Perhaps what we really ought to be working on is
> finding MSVC equivalents for __builtin_clz and friends.

Apparently clz() can be written using _BitScanReverse(), per
https://stackoverflow.com/a/20468180
https://docs.microsoft.com/en-us/cpp/intrinsics/bitscanreverse-bitscanreverse64?view=vs-2015

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Remove libpq.rc, use win32ver.rc for libpq
Следующее
От: David Fetter
Дата:
Сообщение: Re: use CLZ instruction in AllocSetFreeIndex()