Re: Off topic 'C' question

Поиск
Список
Период
Сортировка
От Alfred Perlstein
Тема Re: Off topic 'C' question
Дата
Msg-id 20000729202621.N21967@fw.wintelcom.net
обсуждение исходный текст
Ответ на Off topic 'C' question  (Mike Mascari <mascarm@mascari.com>)
Список pgsql-hackers
* Mike Mascari <mascarm@mascari.com> [000729 18:40] wrote:
> I have a quick question. What is the quickest way to determine
> the next highest power of two which is greater than a given
> integer in 'C'. For example, given the number 7, I would like to
> return 8. Given the number 13, I would like to return 16, etc. Is
> there a gem to do this without shifting a bit value from 1 left
> up to a maximum of 32 (or 64) iterations? 
> 
> Thanks for any info, 

Think "binary search".

-Alfred


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

Предыдущее
От: Mike Mascari
Дата:
Сообщение: Off topic 'C' question
Следующее
От: Mike Mascari
Дата:
Сообщение: Re: Off topic 'C' question