From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38977) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZIDyL-0006Xw-OP for qemu-devel@nongnu.org; Thu, 23 Jul 2015 06:43:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZIDyK-0006IL-5l for qemu-devel@nongnu.org; Thu, 23 Jul 2015 06:43:29 -0400 Received: from mail-wi0-x230.google.com ([2a00:1450:400c:c05::230]:34973) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZIDyJ-0006I5-Vg for qemu-devel@nongnu.org; Thu, 23 Jul 2015 06:43:28 -0400 Received: by wibxm9 with SMTP id xm9so202218828wib.0 for ; Thu, 23 Jul 2015 03:43:27 -0700 (PDT) Sender: Paolo Bonzini References: <1437646847-3015-1-git-send-email-chenhanxiao@cn.fujitsu.com> From: Paolo Bonzini Message-ID: <55B0C54D.7000005@redhat.com> Date: Thu, 23 Jul 2015 12:43:25 +0200 MIME-Version: 1.0 In-Reply-To: <1437646847-3015-1-git-send-email-chenhanxiao@cn.fujitsu.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] exec: use macro for alignment List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Chen Hanxiao Cc: qemu-devel@nongnu.org On 23/07/2015 12:20, Chen Hanxiao wrote: > > +#define ALIGN(x, y) (((x)+(y)-1) & ~((y)-1)) > + > static void *file_ram_alloc(RAMBlock *block, > ram_addr_t memory, > const char *path, > @@ -1207,7 +1209,7 @@ static void *file_ram_alloc(RAMBlock *block, > unlink(filename); > g_free(filename); > > - memory = (memory+hpagesize-1) & ~(hpagesize-1); > + memory = ALIGN(memory, hpagesize); > Hi, the patch is a good idea, but please use ROUND_UP instead of defining your own ALIGN macro. Thanks! Paolo