Received: from eggs.gnu.org ([2001:4830:134:3::10]:50584) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YWK5q-0006xW-JH for qemu-devel@nongnu.org; Fri, 13 Mar 2015 03:33:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YWK5m-0008Mw-JW for qemu-devel@nongnu.org; Fri, 13 Mar 2015 03:33:14 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44437) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YWK5m-0008Mk-Cn for qemu-devel@nongnu.org; Fri, 13 Mar 2015 03:33:10 -0400 From: Markus Armbruster References: <1424694237-22786-1-git-send-email-aik@ozlabs.ru> <877fv8sp97.fsf@blackfin.pond.sub.org> <54ED19E9.4050503@ozlabs.ru> <877fv6gth5.fsf@blackfin.pond.sub.org> <5501B0CC.3090500@twiddle.net> Date: Fri, 13 Mar 2015 08:33:03 +0100 In-Reply-To: <5501B0CC.3090500@twiddle.net> (Richard Henderson's message of "Thu, 12 Mar 2015 08:29:16 -0700") Message-ID: <87oanxqrm8.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH v2] utils: Add pow2ceil() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Richard Henderson Cc: Alexey Kardashevskiy , Peter Maydell , qemu-devel@nongnu.org Richard Henderson writes: > On 02/25/2015 02:45 AM, Markus Armbruster wrote: >> return 0x8000000000000000u >> (clz64(value - 1) - 1); > > I realize this was weeks ago, but it would certainly be preferable to shift a > small constant left than a large constant right. > > Most RISC machines can't form 0x8000000000000000ull without loading 1 and then > left shifting to start with. So end the end you're better off with > > return 1ull << (63 - clz64(value)); I intend to respin my own "[PATCH 0/2] Proactive pow2floor() fix, and dead code removal", and I'll keep your advice in mind for that.