[Spice-devel] [PATCH spice-common 4/5] lz: Simplify code
Frediano Ziglio
fziglio at redhat.com
Wed Jan 17 15:55:19 UTC 2018
Remove some conditional code always defining CAST_PLT_DISTANCE
macro.
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
common/lz_decompress_tmpl.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/common/lz_decompress_tmpl.c b/common/lz_decompress_tmpl.c
index 0189f86..d445c70 100644
--- a/common/lz_decompress_tmpl.c
+++ b/common/lz_decompress_tmpl.c
@@ -153,6 +153,10 @@
#endif // TO_RGB32
#endif
+#ifndef CAST_PLT_DISTANCE
+#define CAST_PLT_DISTANCE(dist) (dist)
+#endif
+
#ifdef LZ_A8
#ifndef TO_RGB32
#define OUT_PIXEL one_byte_pixel_t
@@ -261,12 +265,8 @@ static size_t FNAME(decompress)(Encoder *encoder, OUT_PIXEL *out_buf, int size)
#endif
ofs += 1; // offset is biased by 1 (fixing bias)
-#if defined(TO_RGB32)
-#if defined(PLT4_BE) || defined(PLT4_LE) || defined(PLT1_BE) || defined(PLT1_LE)
ofs = CAST_PLT_DISTANCE(ofs);
len = CAST_PLT_DISTANCE(len);
-#endif
-#endif
ref -= ofs;
spice_assert(op + len <= op_limit);
@@ -295,12 +295,7 @@ static size_t FNAME(decompress)(Encoder *encoder, OUT_PIXEL *out_buf, int size)
}
} else { // copy
ctrl++; // copy count is biased by 1
-#if defined(TO_RGB32) && (defined(PLT4_BE) || defined(PLT4_LE) || defined(PLT1_BE) || \
- defined(PLT1_LE))
spice_assert(op + CAST_PLT_DISTANCE(ctrl) <= op_limit);
-#else
- spice_assert(op + ctrl <= op_limit);
-#endif
COPY_COMP_PIXEL(encoder, op);
spice_assert(op <= op_limit);
--
2.14.3
More information about the Spice-devel
mailing list