Re: [Libguestfs] [PATCH nbdkit 3/5] common/include: Add next_power_of_2 function

2023-05-16 Thread Laszlo Ersek
On 5/16/23 14:29, Eric Blake wrote: > > On Tue, May 16, 2023 at 01:12:17PM +0100, Richard W.M. Jones wrote: >> >> It takes a 64 bit integer and finds the next power of 2, >> eg. next_power_of_2 (510) => 512 (2^9) >> >> Taken from https://jameshfisher.com/2018/03/30/round-up-power-2/ >> with some f

Re: [Libguestfs] [PATCH nbdkit 3/5] common/include: Add next_power_of_2 function

2023-05-16 Thread Richard W.M. Jones
On Tue, May 16, 2023 at 07:29:45AM -0500, Eric Blake wrote: > > On Tue, May 16, 2023 at 01:12:17PM +0100, Richard W.M. Jones wrote: > > > > It takes a 64 bit integer and finds the next power of 2, > > eg. next_power_of_2 (510) => 512 (2^9) > > > > Taken from https://jameshfisher.com/2018/03/30/r

Re: [Libguestfs] [PATCH nbdkit 3/5] common/include: Add next_power_of_2 function

2023-05-16 Thread Eric Blake
On Tue, May 16, 2023 at 01:12:17PM +0100, Richard W.M. Jones wrote: > > It takes a 64 bit integer and finds the next power of 2, > eg. next_power_of_2 (510) => 512 (2^9) > > Taken from https://jameshfisher.com/2018/03/30/round-up-power-2/ > with some fixes. > --- > common/include/ispowerof2.h

[Libguestfs] [PATCH nbdkit 3/5] common/include: Add next_power_of_2 function

2023-05-16 Thread Richard W.M. Jones
It takes a 64 bit integer and finds the next power of 2, eg. next_power_of_2 (510) => 512 (2^9) Taken from https://jameshfisher.com/2018/03/30/round-up-power-2/ with some fixes. --- common/include/ispowerof2.h | 9 + common/include/test-ispowerof2.c | 14 ++ 2 files chan