From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35487) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YPrzt-0001vG-Aa for qemu-devel@nongnu.org; Mon, 23 Feb 2015 07:20:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YPrzq-00078s-5c for qemu-devel@nongnu.org; Mon, 23 Feb 2015 07:20:25 -0500 Received: from mail-pd0-f172.google.com ([209.85.192.172]:36246) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YPrzq-00078c-0R for qemu-devel@nongnu.org; Mon, 23 Feb 2015 07:20:22 -0500 Received: by pdjp10 with SMTP id p10so25091373pdj.3 for ; Mon, 23 Feb 2015 04:20:21 -0800 (PST) Message-ID: <54EB1AFD.2060809@ozlabs.ru> Date: Mon, 23 Feb 2015 23:20:13 +1100 From: Alexey Kardashevskiy MIME-Version: 1.0 References: <1424677796-3044-1-git-send-email-aik@ozlabs.ru> In-Reply-To: Content-Type: text/plain; charset=koi8-r; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC PATCH] utils: Add up_pow_of_two() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: QEMU Developers , Alexander Graf On 02/23/2015 07:54 PM, Peter Maydell wrote: > On 23 February 2015 at 16:49, Alexey Kardashevskiy wrote: >> This adds a helper to get closest bigger power-of-two value. >> >> Signed-off-by: Alexey Kardashevskiy >> --- >> >> It is a log2 of round up to power of two. Is there anything like this >> in QEMU already? Any better name than up_pow_of_two()? > > Maybe separate out the "round up to power of 2" and "log2" parts > into separate functions? If you do that then you could call the > first one of those pow2ceil(), to match our existing > pow2floor(). good point, powe2ceil() is enough for me, I'll repost it in a sec. thanks! -- Alexey