From 21aa9ea9e342f2bfb2b4752dd4a382cf9d4c048b Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Tue, 27 May 2014 11:23:22 -0500 Subject: [PATCH] lzx-decompress.c: One fewer branch in undo_call_insn_translation() --- src/lzx-decompress.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/lzx-decompress.c b/src/lzx-decompress.c index f7f66616..da8950a2 100644 --- a/src/lzx-decompress.c +++ b/src/lzx-decompress.c @@ -672,15 +672,20 @@ undo_call_insn_translation(u32 *call_insn_target, s32 input_pos) s32 rel_offset; abs_offset = le32_to_cpu(*call_insn_target); - if (abs_offset >= -input_pos && abs_offset < LZX_WIM_MAGIC_FILESIZE) { - if (abs_offset >= 0) { + if (abs_offset >= 0) { + if (abs_offset < LZX_WIM_MAGIC_FILESIZE) { /* "good translation" */ rel_offset = abs_offset - input_pos; - } else { + + *call_insn_target = cpu_to_le32(rel_offset); + } + } else { + if (abs_offset >= -input_pos) { /* "compensating translation" */ rel_offset = abs_offset + LZX_WIM_MAGIC_FILESIZE; + + *call_insn_target = cpu_to_le32(rel_offset); } - *call_insn_target = cpu_to_le32(rel_offset); } } -- 2.43.0