[Spice-commits] common/lz_compress_tmpl.c

Frediano Ziglio fziglio at kemper.freedesktop.org
Thu Jun 2 09:02:36 UTC 2016


 common/lz_compress_tmpl.c |   28 ++++++++++++----------------
 1 file changed, 12 insertions(+), 16 deletions(-)

New commits:
commit 73282208f0eee013d670c97b8cb3dd034494e4c6
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Fri May 13 12:46:03 2016 +0100

    simplify #ifdef code
    
    Reduce conditional code
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Jonathon Jongsma <jjongsma at redhat.com>

diff --git a/common/lz_compress_tmpl.c b/common/lz_compress_tmpl.c
index 0305278..1bb5c75 100644
--- a/common/lz_compress_tmpl.c
+++ b/common/lz_compress_tmpl.c
@@ -403,27 +403,23 @@ match:        // RLE or dictionary (both are encoded by distance from ref (-1) a
 
         /* update the hash at match boundary */
 #if defined(LZ_RGB16) || defined(LZ_RGB24) || defined(LZ_RGB32)
-        if (ip > anchor) {
+        if (ip > anchor)
 #endif
-        HASH_FUNC(hval, ip);
-        encoder->htab[hval].ref = (uint8_t *)ip;
+        {
+            HASH_FUNC(hval, ip);
+            encoder->htab[hval].ref = (uint8_t *)ip;
+            encoder->htab[hval].image_seg = seg;
+        }
         ip++;
-        encoder->htab[hval].image_seg = seg;
-#if defined(LZ_RGB16) || defined(LZ_RGB24) || defined(LZ_RGB32)
-    } else {ip++;
-    }
-#endif
 #if defined(LZ_RGB24) || defined(LZ_RGB32)
-        if (ip > anchor) {
+        if (ip > anchor)
 #endif
-        HASH_FUNC(hval, ip);
-        encoder->htab[hval].ref = (uint8_t *)ip;
+        {
+            HASH_FUNC(hval, ip);
+            encoder->htab[hval].ref = (uint8_t *)ip;
+            encoder->htab[hval].image_seg = seg;
+        }
         ip++;
-        encoder->htab[hval].image_seg = seg;
-#if defined(LZ_RGB24) || defined(LZ_RGB32)
-    } else {ip++;
-    }
-#endif
         /* assuming literal copy */
         encode_copy_count(encoder, MAX_COPY - 1);
         continue;


More information about the Spice-commits mailing list