Received: from eggs.gnu.org ([208.118.235.92]:51189) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T1bRZ-0002bC-Oz for qemu-devel@nongnu.org; Wed, 15 Aug 2012 07:07:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T1bRY-0000sx-D2 for qemu-devel@nongnu.org; Wed, 15 Aug 2012 07:07:21 -0400 Received: from isrv.corpit.ru ([86.62.121.231]:42707) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T1bRY-0000sl-5v for qemu-devel@nongnu.org; Wed, 15 Aug 2012 07:07:20 -0400 Message-ID: <502B82DE.1060203@msgid.tls.msk.ru> Date: Wed, 15 Aug 2012 15:07:10 +0400 From: Michael Tokarev MIME-Version: 1.0 References: <1345021819-892-1-git-send-email-e.voevodin@samsung.com> In-Reply-To: <1345021819-892-1-git-send-email-e.voevodin@samsung.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] savevm.c: Fix compilation error on 32bit host. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Evgeny Voevodin Cc: peter.maydell@linaro.org, aliguori@us.ibm.com, quintela@redhat.com, qemu-devel@nongnu.org, owasserm@redhat.com, kyungmin.park@samsung.com On 15.08.2012 13:10, Evgeny Voevodin wrote: > Casting of 0x0101010101010101ULL to long will truncate it to 32 > bits on 32bit hosts, and won't truncate on 64bit hosts. > > Signed-off-by: Evgeny Voevodin > --- > savevm.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/savevm.c b/savevm.c > index 0ea10c9..9ab4d83 100644 > --- a/savevm.c > +++ b/savevm.c > @@ -2473,7 +2473,7 @@ int xbzrle_encode_buffer(uint8_t *old_buf, uint8_t *new_buf, int slen, > /* word at a time for speed, use of 32-bit long okay */ > if (!res) { > /* truncation to 32-bit long okay */ > - long mask = 0x0101010101010101ULL; > + long mask = (long)0x0101010101010101ULL; > while (i < slen) { > xor = *(long *)(old_buf + i) ^ *(long *)(new_buf + i); > if ((xor - mask) & ~xor & (mask << 7)) { Um, how it is ugly... Can't we use unsigned types for all this stuff? Including slen too - the function parameter... Thanks, /mjt