[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC 0/5] scripts/dump-guest-memory.py: Add multi-arch
From: |
Laszlo Ersek |
Subject: |
Re: [Qemu-devel] [RFC 0/5] scripts/dump-guest-memory.py: Add multi-arch support |
Date: |
Wed, 20 Jan 2016 17:13:18 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 |
On 01/20/16 14:50, Markus Armbruster wrote:
> Paolo Bonzini <address@hidden> writes:
>
>> On 20/01/2016 11:03, Janosch Frank wrote:
>>>
>>> In python 3:
>>> 1/2 == 0.5
>>> 1//2 == 0
>>> but a // b == floor(a/b), i.e. a cast is made.
>>>
>>> Anyway, I got rid of the import with:
>>> -(-len_desc // 4)
>>
>> I would change that to either:
>>
>> def ceil_div(a, b)
>> return -(-a // b)
>>
>> ...
>>
>> ceil_div(len_desc, 4)
>>
>> or
>>
>> (len_desc + 3) / 4
>
> The latter is *far* easier on my eyes. But you'd still have to truncate
> for Python 3.
Yes, I think I had
(len_desc + 3) // 4
in mind (except I didn't know about "//" just yet :))
Thanks
Laszlo
- Re: [Qemu-devel] [RFC 3/5] scripts/dump-guest-memory.py: Improve python 3 compatibility, (continued)