Skip site navigation (1) Skip section navigation (2)

Off topic 'C' question

From: Mike Mascari <mascarm(at)mascari(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Off topic 'C' question
Date: 2000-07-30 01:38:33
Message-ID: 39838719.9FE4EB40@mascari.com (view raw or flat)
Thread:
Lists: 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

Responses

pgsql-hackers by date

Next:From: Alfred PerlsteinDate: 2000-07-30 03:26:22
Subject: Re: Off topic 'C' question
Previous:From: Hiroshi InoueDate: 2000-07-30 01:35:47
Subject: another ? lock freezing

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group