]> wimlib.net Git - wimlib/commitdiff
lzx-decompress.c: One fewer branch in undo_call_insn_translation()
authorEric Biggers <ebiggers3@gmail.com>
Tue, 27 May 2014 16:23:22 +0000 (11:23 -0500)
committerEric Biggers <ebiggers3@gmail.com>
Tue, 27 May 2014 16:23:22 +0000 (11:23 -0500)
src/lzx-decompress.c

index f7f6661649cb78fae376ad7c3a4e29c63c11df70..da8950a2572e884eced9944937f97f355a3c215e 100644 (file)
@@ -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);
        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;
                        /* "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;
                        /* "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);
        }
 }
 
        }
 }