decompress_generic: Add a loop fastpath
authorDave Watson <davejwatson@fb.com>
Thu, 24 Jan 2019 21:42:25 +0000 (13:42 -0800)
committerDave Watson <davejwatson@fb.com>
Fri, 8 Feb 2019 21:57:19 +0000 (13:57 -0800)
commit28356e02ad6f6dac529302cedf707712c5b628fe
tree6946e74e8f39b0bd940c239d6768722543c162df
parent4da336062e5b295c0a54bb3683cdc6ca9ba23ca3
decompress_generic: Add a loop fastpath

Copy the main loop, and change checks such that op is always less
than oend-SAFE_DISTANCE.  Currently these are added for the literal
copy length check, and for the match copy length check.

Otherwise the first loop is exactly the same as the second.  Follow on
diffs will optimize the first copy loop based on this new requirement.

I also tried instead making a separate inlineable function for the copy
loop (similar to existing partialDecode flags, etc), but I think the
changes might be significant enough to warrent doubling the code, instead
pulling out common functionality to separate functions.

This is the basic transformation that will allow several following optimisations.
lib/lz4.c