qemu-trivial.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-trivial] [PATCH] savevm: fix compiler warning
@ 2012-08-14 20:18 Alberto Garcia
  2012-08-15 13:30 ` Stefan Hajnoczi
  0 siblings, 1 reply; 2+ messages in thread
From: Alberto Garcia @ 2012-08-14 20:18 UTC (permalink / raw)
  To: qemu-trivial; +Cc: Orit Wasserman

If we have a 32-bit long then the truncation of a 64-bit value will
produce a compiler warning unless we make an explicit cast.
---
 savevm.c |    2 +-
 1 ficheiro modificado, 1 adição(+), 1 eliminado(-)

diff --git a/savevm.c b/savevm.c
index 0ea10c9..c89fc4e 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)) {
-- 
1.7.10.4



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-08-15 13:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-14 20:18 [Qemu-trivial] [PATCH] savevm: fix compiler warning Alberto Garcia
2012-08-15 13:30 ` Stefan Hajnoczi

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).