]> wimlib.net Git - wimlib/blobdiff - src/lzms_decompress.c
decompress_common: introduce fast path for lz_copy()
[wimlib] / src / lzms_decompress.c
index 4791054a7f468202d21e97d60fe830cc0667ee03..d6de2990726908ee4d25abcefb1c0fda7fe15f5b 100644 (file)
@@ -822,12 +822,10 @@ lzms_decompress(const void * const restrict in, const size_t in_nbytes,
 
                        length = lzms_decode_length(d, &is);
 
-                       if (unlikely(length > out_end - out_next))
-                               return -1;
-                       if (unlikely(offset > out_next - (u8 *)out))
+                       if (unlikely(lz_copy(length, offset, out, out_next, out_end,
+                                            LZMS_MIN_MATCH_LENGTH)))
                                return -1;
 
-                       lz_copy(out_next, length, offset, out_end, LZMS_MIN_MATCH_LENGTH);
                        out_next += length;
                } else {
                        /* Delta match  */