167 Commits

Author SHA1 Message Date
Eric Biggers
0d1260be99 lib/x86: allow CPU feature detection on 32-bit x86
The SSE2, AVX2, BMI2, etc. code actually works on 32-bit x86 if the CPU
has those features.  So there is no need to restrict it to x86_64-only.
2018-02-18 23:03:26 -08:00
Eric Biggers
58978af429 lib: make CPU feature masks and dispatch pointers volatile
Use 'volatile' for the CPU feature masks and dispatched function
pointers.  We don't need memory barriers for them, so 'volatile' is good
enough to stop the compiler from inserting bogus reads/writes.
2018-02-18 23:03:26 -08:00
Eric Biggers
4829a5add2 lib: refactor architecture-specific code
Move the x86 and ARM-specific code into their own directories to prevent
it from cluttering up the main library.  This will make it a bit easier
to add new architecture-specific code.

But to avoid complicating things too much for people who aren't using
the provided Makefile, we still just compile all .c files for all
architectures (irrelevant ones end up #ifdef'ed out), and the headers
are included explicitly for each architecture so that an
architecture-specific include path isn't needed.  So, now people just
need to compile both lib/*.c and lib/*/*.c instead of only lib/*.c.
2018-02-18 23:03:26 -08:00
Eric Biggers
0191c6bc26 lib: remove unused x86_cpu_features functionality
Remove the unused CPU features as well as the DEBUG code.
2018-02-18 23:03:26 -08:00
Eric Biggers
f76dcd5ee1 common: replace COMPILER_SUPPORTS_TARGET_INTRINSICS
Replace COMPILER_SUPPORTS_TARGET_INTRINSICS with macros for the
individual features, since COMPILER_SUPPORTS_TARGET_INTRINSICS was
x86-specific and would cause confusion when we try to use intrinsics in
'target' functions for other architectures.
2018-02-18 23:03:26 -08:00
Eric Biggers
5a9d25a892 Support multi-member gzip files 2017-11-20 00:35:24 -08:00
Eric Biggers
3d96a83ef9 v0.8 v0.8 2017-07-29 14:38:03 -07:00
Eric Biggers
48dcf684ec Improve instructions for building libdeflate on Windows 2017-06-09 18:53:04 -07:00
Eric Biggers
1726e9e87f benchmark: make it easier to integrate other compression/decompression engines 2017-05-29 18:37:01 -07:00
Eric Biggers
65a119ddfd run_tests.sh: test for same output on big endian CPU 2017-05-29 18:25:07 -07:00
Eric Biggers
8067f44e8c run_tests.sh: portability improvements
Support running the run_tests.sh script on more types of systems.
2017-05-29 17:44:50 -07:00
Eric Biggers
aadf6d8198 deflate_compress: produce same results on all CPUs 2017-05-29 17:44:50 -07:00
Eric Biggers
e42013f92e bt_matchfinder: produce same results on big endian CPUs 2017-05-29 17:38:58 -07:00
Eric Biggers
c4aca64dcb hc_matchfinder: produce same results on big endian CPUs 2017-05-29 17:38:58 -07:00
Eric Biggers
a53e457a5a matchfinder_common: fix conditions for vectorized init and rebase 2017-05-29 17:38:55 -07:00
Eric Biggers
1f8090cda1 Makefile: set $(AR) more reliably when building with MinGW 2017-04-30 21:07:05 -07:00
Eric Biggers
671e2bb5b5 Compile programs with -D_POSIX_C_SOURCE=200809L
The _DEFAULT_SOURCE feature test macro is only supported by glibc 2.19
and later.  As a result, various things were not being defined when
building with an older glibc version, causing compile errors.  Instead,
_POSIX_C_SOURCE=200809L should expose everything we need.
2017-04-12 22:11:17 -07:00
Eric Biggers
27c13370cb run_tests.sh: run tests on arm64 2017-03-19 12:29:49 -07:00
Eric Biggers
a32bdb097d v0.7 v0.7 2017-01-14 20:56:17 -08:00
Eric Biggers
f2f0df7274 deflate_compress: fix corruption with long literal run
When the block splitting algorithm was implemented, it became possible
for the compressor to use longer blocks, up to ~300KB.  Unfortunately it
was overlooked that this can allow literal runs > 65535 bytes, while in
one place the length of a literal run was still being stored in a u16.
To overflow the litrunlen and hit the bug the data would have had to
have far fewer matches than random data, which is possible but very
unusual.  Fix the bug by reserving more space to hold the litrunlen, and
add a test for it.
2017-01-14 20:51:03 -08:00
Eric Biggers
e79444be27 Fix compilation with icc 2016-11-07 19:45:37 -08:00
Eric Biggers
28cc14994b run_tests.sh: look for other clang versions 2016-11-04 21:27:50 -07:00
Eric Biggers
3a3d2da7c2 Fix compilation with clang 3.7 2016-11-04 21:24:44 -07:00
Eric Biggers
2ea8ddae66 Don't use 'defined' in macro expansion
With clang 3.9:
	warning: macro expansion producing 'defined' has undefined
		 behavior [-Wexpansion-to-defined]

Just eliminate the tests for clang and icc; they shouldn't be necessary.
2016-10-30 12:40:47 -07:00
Eric Biggers
702871d310 v0.6 v0.6 2016-10-27 20:51:32 -07:00
Eric Biggers
62cc3d71b4 Add PCLMUL/AVX-optimized CRC32 2016-10-27 20:33:35 -07:00
Eric Biggers
0e4c2c8597 x86_cpu_features: allow testing for multiple features 2016-10-23 22:35:58 -07:00
Eric Biggers
0776bc94d7 Add script to test gcc profile-guided optimizations 2016-10-23 21:59:57 -07:00
Eric Biggers
99d6e72b89 Add gzip program tests 2016-10-23 14:13:36 -07:00
Eric Biggers
8be0bbfabb gzip, gunzip: accept -n option 2016-10-23 14:13:36 -07:00
Eric Biggers
5cc0fc2bbd gzip, gunzip: add dumb support for reading from stdin
No streaming yet, but as a temporary solution just read the full file
contents.
2016-10-23 13:54:53 -07:00
Eric Biggers
3a7658d144 gzip, gunzip: avoid hanging when opening special files
This matches the behavior of GNU gzip.
2016-10-23 13:54:53 -07:00
Eric Biggers
f100a42c02 gzip, gunzip: require -f or -c to (de)compress symlink
This matches the behavior of GNU gzip.
2016-10-23 13:54:53 -07:00
Eric Biggers
e4029d1e70 gzip, gunzip: warning rather than error when output file already exists
This matches the behavior of GNU gzip.
2016-10-23 13:54:53 -07:00
Eric Biggers
618958f4dd gunzip: automatically append suffix to find input file if needed 2016-10-23 13:54:53 -07:00
Eric Biggers
f3861da7cd prog_util: use 64-bit 'struct stat' on Windows and support stat() 2016-10-23 13:54:53 -07:00
Eric Biggers
4dbc5173b6 prog_util: always use 64-bit utime() on Windows 2016-10-23 13:54:53 -07:00
Eric Biggers
e7152b4866 gzip, gunzip: forbid empty suffix
This matches the behavior of GNU gzip.
2016-10-23 13:54:52 -07:00
Eric Biggers
ed923c45d4 gzip: use success status when file already has compressed suffix
This matches the behavior of GNU gzip.
2016-10-23 13:54:52 -07:00
Eric Biggers
b620773954 gzip, gunzip: don't add dot to user-specified suffix
This matches the behavior of GNU gzip.
2016-10-23 13:54:52 -07:00
Eric Biggers
0205f005bc deflate_compress: don't pass NULL to memcpy on empty input 2016-10-23 13:54:52 -07:00
Eric Biggers
2b047b097b gzip: allow compressing empty files 2016-10-23 13:54:52 -07:00
Eric Biggers
8d0a43ac2e gzip: detect gunzip if invoked as libdeflate-gunzip 2016-10-22 14:57:00 -07:00
Eric Biggers
1cc88c6f86 prog_util: remove unused skip_bytes() function 2016-10-16 18:16:38 -07:00
Eric Biggers
31c4ac39a7 programs: fix signs of some exit statuses 2016-10-16 17:37:32 -07:00
Eric Biggers
e20e275081 prog_util: use QueryPerformanceCounter() on Windows
QueryPerformanceCounter() is much more accurate than
GetSystemTimeAsFileTime().

Also avoid converting into a specific time unit until the results need
to be displayed.  This is more efficient and avoids losing precision.
2016-10-16 14:20:18 -07:00
Eric Biggers
7662390f55 run_tests.sh: fix Android device detection 2016-10-16 12:14:21 -07:00
Eric Biggers
14007c05fa run_tests.sh: improve reporting of Android test failures 2016-10-16 12:14:16 -07:00
Eric Biggers
0cd875d811 run_tests.sh: improve/fix test group handling 2016-10-16 12:13:02 -07:00
Eric Biggers
b16dc97e3b v0.5 v0.5 2016-10-15 22:05:14 -07:00