On 03/12/2015 09:45 AM, Eric Blake wrote:
> On 03/12/2015 09:29 AM, Richard Henderson wrote:
>> On 02/25/2015 02:45 AM, Markus Armbruster wrote:
>>> return 0x8000u >> (clz64(value - 1) - 1);
>>
>> I realize this was weeks ago, but it would certainly be preferable to shift a
>> small con
Richard Henderson writes:
> On 02/25/2015 02:45 AM, Markus Armbruster wrote:
>> return 0x8000u >> (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 f
On 03/12/2015 09:29 AM, Richard Henderson wrote:
> On 02/25/2015 02:45 AM, Markus Armbruster wrote:
>> return 0x8000u >> (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.
>
> Mos
On 02/25/2015 02:45 AM, Markus Armbruster wrote:
> return 0x8000u >> (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 0x8000ull without loadi
Alexey Kardashevskiy writes:
> On 02/24/2015 12:59 AM, Markus Armbruster wrote:
>> Alexey Kardashevskiy writes:
>>
>>> This adds a helper to get closest bigger power-of-two value.
>>>
>>> Signed-off-by: Alexey Kardashevskiy
>>> ---
>>> Changes:
>>> v2:
>>> * s/up_pow_of_two/pow2ceil/
>>> ---
>>
On 02/24/2015 12:59 AM, Markus Armbruster wrote:
Alexey Kardashevskiy writes:
This adds a helper to get closest bigger power-of-two value.
Signed-off-by: Alexey Kardashevskiy
---
Changes:
v2:
* s/up_pow_of_two/pow2ceil/
---
include/qemu-common.h | 2 ++
util/cutils.c | 9 +
Peter Maydell writes:
> On 24 February 2015 at 18:39, Markus Armbruster wrote:
>> Eric Blake writes:
>>> Because 0x8000u is only required to be a 'long', and on
>>> 32-bit machines, your constant would overflow long. See, for example,
>>> commit 5cb6be2ca. You NEED the 'll' suffix
On 24 February 2015 at 18:39, Markus Armbruster wrote:
> Eric Blake writes:
>> Because 0x8000u is only required to be a 'long', and on
>> 32-bit machines, your constant would overflow long. See, for example,
>> commit 5cb6be2ca. You NEED the 'll' suffix to ensure that the compiler
>
Eric Blake writes:
> On 02/23/2015 10:40 AM, Markus Armbruster wrote:
>
int64_t pow2floor(int64_t value)
{
assert(value > 0);
return 0x8000u >> clz64(value);
}
>>>
>>> Needs to be 0x8000ull for 32-bit machines to compile correctly.
>>
>> W
On 02/23/2015 10:40 AM, Markus Armbruster wrote:
>>> int64_t pow2floor(int64_t value)
>>> {
>>> assert(value > 0);
>>> return 0x8000u >> clz64(value);
>>> }
>>
>> Needs to be 0x8000ull for 32-bit machines to compile correctly.
>
> Why?
Because 0x8000u
On 02/23/2015 06:59 AM, Markus Armbruster wrote:
> Alexey Kardashevskiy writes:
>
>> This adds a helper to get closest bigger power-of-two value.
>>
>
> Here's how I'd do these functions:
>
> int64_t pow2floor(int64_t value)
> {
> assert(value > 0);
> return 0x8000u >> clz6
Alexey Kardashevskiy writes:
> This adds a helper to get closest bigger power-of-two value.
>
> Signed-off-by: Alexey Kardashevskiy
> ---
> Changes:
> v2:
> * s/up_pow_of_two/pow2ceil/
> ---
> include/qemu-common.h | 2 ++
> util/cutils.c | 9 +
> 2 files changed, 11 insertions(
This adds a helper to get closest bigger power-of-two value.
Signed-off-by: Alexey Kardashevskiy
---
Changes:
v2:
* s/up_pow_of_two/pow2ceil/
---
include/qemu-common.h | 2 ++
util/cutils.c | 9 +
2 files changed, 11 insertions(+)
diff --git a/include/qemu-common.h b/include/qem
13 matches
Mail list logo