[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2] utils: Add pow2ceil()
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [PATCH v2] utils: Add pow2ceil() |
Date: |
Fri, 13 Mar 2015 08:33:03 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
Richard Henderson <address@hidden> 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.