From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51274) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLt9P-0007tH-8Z for qemu-devel@nongnu.org; Wed, 20 Jan 2016 08:50:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aLt9L-000297-9L for qemu-devel@nongnu.org; Wed, 20 Jan 2016 08:50:19 -0500 Received: from mx1.redhat.com ([209.132.183.28]:42906) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLt9L-00028T-4L for qemu-devel@nongnu.org; Wed, 20 Jan 2016 08:50:15 -0500 From: Markus Armbruster References: <1452761307-57200-1-git-send-email-frankja@linux.vnet.ibm.com> <5697CBB7.4070805@redhat.com> <20160118163112.GI4075@hawk.localdomain> <569D2797.7010605@redhat.com> <569F5B89.3070103@linux.vnet.ibm.com> <569F70B2.9030201@redhat.com> Date: Wed, 20 Jan 2016 14:50:11 +0100 In-Reply-To: <569F70B2.9030201@redhat.com> (Paolo Bonzini's message of "Wed, 20 Jan 2016 12:34:10 +0100") Message-ID: <8737tsweb0.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [RFC 0/5] scripts/dump-guest-memory.py: Add multi-arch support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Janosch Frank , Andrew Jones , Laszlo Ersek , qemu-devel@nongnu.org Paolo Bonzini 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.