qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Laszlo Ersek <lersek@redhat.com>
To: Markus Armbruster <armbru@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>
Cc: Janosch Frank <frankja@linux.vnet.ibm.com>,
	Andrew Jones <drjones@redhat.com>,
	qemu-devel@nongnu.org
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	[thread overview]
Message-ID: <569FB21E.6050906@redhat.com> (raw)
In-Reply-To: <8737tsweb0.fsf@blackfin.pond.sub.org>

On 01/20/16 14:50, Markus Armbruster wrote:
> Paolo Bonzini <pbonzini@redhat.com> 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

      reply	other threads:[~2016-01-20 16:13 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-14  8:48 [Qemu-devel] [RFC 0/5] scripts/dump-guest-memory.py: Add multi-arch support Janosch Frank
2016-01-14  8:48 ` [Qemu-devel] [RFC 1/5] scripts/dump-guest-memory.py: Move constants to the top Janosch Frank
2016-01-14  8:48 ` [Qemu-devel] [RFC 2/5] scripts/dump-guest-memory.py: Make methods functions Janosch Frank
2016-01-14  8:48 ` [Qemu-devel] [RFC 3/5] scripts/dump-guest-memory.py: Improve python 3 compatibility Janosch Frank
2016-01-14 16:03   ` Laszlo Ersek
2016-01-15 10:05     ` Janosch Frank
2016-01-20 11:18   ` Paolo Bonzini
2016-01-20 13:02     ` Janosch Frank
2016-01-14  8:48 ` [Qemu-devel] [RFC 4/5] scripts/dump-guest-memory.py: Cleanup functions Janosch Frank
2016-01-14 16:11   ` Laszlo Ersek
2016-01-14  8:48 ` [Qemu-devel] [RFC 5/5] scripts/dump-guest-memory.py: Introduce multi-arch support Janosch Frank
2016-01-14 16:24 ` [Qemu-devel] [RFC 0/5] scripts/dump-guest-memory.py: Add " Laszlo Ersek
2016-01-18 16:31   ` Andrew Jones
2016-01-18 17:57     ` Laszlo Ersek
2016-01-20 10:03       ` Janosch Frank
2016-01-20 11:34         ` Paolo Bonzini
2016-01-20 13:50           ` Markus Armbruster
2016-01-20 16:13             ` Laszlo Ersek [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=569FB21E.6050906@redhat.com \
    --to=lersek@redhat.com \
    --cc=armbru@redhat.com \
    --cc=drjones@redhat.com \
    --cc=frankja@linux.vnet.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).