summaryrefslogtreecommitdiffstats
path: root/xbzrle.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2014-04-24 13:22:16 +0100
committerPeter Maydell <peter.maydell@linaro.org>2014-04-24 13:22:16 +0100
commit4b8abfb78e99c1fef23a5bd99ea9ab4718dfb57d (patch)
tree35aa02ed80529671ecc912cbb76cc3c6a28a3337 /xbzrle.c
parent2d03b49c3f225994c4b0b46146437d8c887d6774 (diff)
parentb36dc67b95dedcece8757ec23bf42625a7ccda34 (diff)
downloadhqemu-4b8abfb78e99c1fef23a5bd99ea9ab4718dfb57d.zip
hqemu-4b8abfb78e99c1fef23a5bd99ea9ab4718dfb57d.tar.gz
Merge remote-tracking branch 'remotes/mjt/tags/trivial-patches-2014-04-18' into staging
trivial patches for 2014-04-18 # gpg: Signature made Fri 18 Apr 2014 07:36:15 BST using RSA key ID A4C3D7DB # gpg: Good signature from "Michael Tokarev <mjt@tls.msk.ru>" # gpg: aka "Michael Tokarev <mjt@corpit.ru>" # gpg: aka "Michael Tokarev <mjt@debian.org>" # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: 6EE1 95D1 886E 8FFB 810D 4324 457C E0A0 8044 65C5 # Subkey fingerprint: 6F67 E18E 7C91 C5B1 5514 66A7 BEE5 9D74 A4C3 D7DB * remotes/mjt/tags/trivial-patches-2014-04-18: Fix grammar in comment doc: grammify "allows to" configure: Remove redundant message for -Werror scripts: add sample model file for Coverity Scan xbzrle.c: Avoid undefined behaviour with signed arithmetic int128.h: Avoid undefined behaviours involving signed arithmetic hw/ide/ahci.c: Avoid shift left into sign bit net: Report error when device / hub combo is not found. configure: Fix indentation of help for --enable/disable-debug-info qga: trivial fix for unclear documentation of guest-set-time vl: Report accelerator not supported for target more nicely Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'xbzrle.c')
-rw-r--r--xbzrle.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/xbzrle.c b/xbzrle.c
index fbcb35d..8e220bf 100644
--- a/xbzrle.c
+++ b/xbzrle.c
@@ -28,7 +28,7 @@ int xbzrle_encode_buffer(uint8_t *old_buf, uint8_t *new_buf, int slen,
{
uint32_t zrun_len = 0, nzrun_len = 0;
int d = 0, i = 0;
- long res, xor;
+ long res;
uint8_t *nzrun_start = NULL;
g_assert(!(((uintptr_t)old_buf | (uintptr_t)new_buf | slen) %
@@ -93,9 +93,11 @@ 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 = (long)0x0101010101010101ULL;
+ unsigned long mask = (unsigned long)0x0101010101010101ULL;
while (i < slen) {
- xor = *(long *)(old_buf + i) ^ *(long *)(new_buf + i);
+ unsigned long xor;
+ xor = *(unsigned long *)(old_buf + i)
+ ^ *(unsigned long *)(new_buf + i);
if ((xor - mask) & ~xor & (mask << 7)) {
/* found the end of an nzrun within the current long */
while (old_buf[i] != new_buf[i]) {
OpenPOWER on IntegriCloud