Off topic 'C' question - Mailing list pgsql-hackers

From Mike Mascari
Subject Off topic 'C' question
Date
Msg-id 39838719.9FE4EB40@mascari.com
Whole thread Raw
Responses Re: Off topic 'C' question  (Alfred Perlstein <bright@wintelcom.net>)
Re: Off topic 'C' question  (JanWieck@t-online.de (Jan Wieck))
Re: Off topic 'C' question  (Louis-David Mitterrand <cunctator@apartia.ch>)
List pgsql-hackers
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, 

Mike Mascari


pgsql-hackers by date:

Previous
From: "Hiroshi Inoue"
Date:
Subject: another ? lock freezing
Next
From: Alfred Perlstein
Date:
Subject: Re: Off topic 'C' question