* [Qemu-devel] [PATCH] savevm.c: Fix compilation error on 32bit host.
@ 2012-08-15 9:10 Evgeny Voevodin
2012-08-15 9:30 ` Peter Maydell
2012-08-15 11:07 ` Michael Tokarev
0 siblings, 2 replies; 4+ messages in thread
From: Evgeny Voevodin @ 2012-08-15 9:10 UTC (permalink / raw)
To: qemu-devel
Cc: peter.maydell, aliguori, Evgeny Voevodin, quintela, owasserm,
kyungmin.park
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 <e.voevodin@samsung.com>
---
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)) {
--
1.7.9.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] savevm.c: Fix compilation error on 32bit host.
2012-08-15 9:10 [Qemu-devel] [PATCH] savevm.c: Fix compilation error on 32bit host Evgeny Voevodin
@ 2012-08-15 9:30 ` Peter Maydell
2012-08-15 9:34 ` Evgeny Voevodin
2012-08-15 11:07 ` Michael Tokarev
1 sibling, 1 reply; 4+ messages in thread
From: Peter Maydell @ 2012-08-15 9:30 UTC (permalink / raw)
To: Evgeny Voevodin; +Cc: owasserm, kyungmin.park, quintela, qemu-devel, aliguori
On 15 August 2012 10:10, Evgeny Voevodin <e.voevodin@samsung.com> 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 <e.voevodin@samsung.com>
Dup of http://patchwork.ozlabs.org/patch/177217/ I'm afraid.
-- PMM
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] savevm.c: Fix compilation error on 32bit host.
2012-08-15 9:30 ` Peter Maydell
@ 2012-08-15 9:34 ` Evgeny Voevodin
0 siblings, 0 replies; 4+ messages in thread
From: Evgeny Voevodin @ 2012-08-15 9:34 UTC (permalink / raw)
To: Peter Maydell; +Cc: owasserm, kyungmin.park, aliguori, qemu-devel, quintela
On 08/15/2012 01:30 PM, Peter Maydell wrote:
> On 15 August 2012 10:10, Evgeny Voevodin <e.voevodin@samsung.com> 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 <e.voevodin@samsung.com>
>
> Dup of http://patchwork.ozlabs.org/patch/177217/ I'm afraid.
>
> -- PMM
>
>
Don't be afraid, it's true. I didn't see it in the mailing list and
didn't know that the bug is already fixed there.
--
Kind regards,
Evgeny Voevodin,
Leading Software Engineer,
ASWG, Moscow R&D center, Samsung Electronics
e-mail: e.voevodin@samsung.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] savevm.c: Fix compilation error on 32bit host.
2012-08-15 9:10 [Qemu-devel] [PATCH] savevm.c: Fix compilation error on 32bit host Evgeny Voevodin
2012-08-15 9:30 ` Peter Maydell
@ 2012-08-15 11:07 ` Michael Tokarev
1 sibling, 0 replies; 4+ messages in thread
From: Michael Tokarev @ 2012-08-15 11:07 UTC (permalink / raw)
To: Evgeny Voevodin
Cc: peter.maydell, aliguori, quintela, qemu-devel, owasserm, kyungmin.park
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 <e.voevodin@samsung.com>
> ---
> 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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-08-15 11:07 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-15 9:10 [Qemu-devel] [PATCH] savevm.c: Fix compilation error on 32bit host Evgeny Voevodin
2012-08-15 9:30 ` Peter Maydell
2012-08-15 9:34 ` Evgeny Voevodin
2012-08-15 11:07 ` Michael Tokarev
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.