Fixed deflate_quick to not emit a block when there is no available input. Pigz requires no blocks to be emitted in certain instances when calling deflate with Z_BLOCK.
Fixed end block not being emitted between calls to deflate_quick causing invalid stored block lengths in certain instances.
Don [Tue, 9 Jun 2020 16:57:05 +0000 (09:57 -0700)]
Remove Borland C++ compiler references
There are a few guards checking for Borland C++ 5.0 or greater which was released
in 1996. While there is still a descendent of this compiler in Embarcadero C++ Builder
its value for __BORLANDC__ is greater than 0x500 so it is safe to remove these guards.
Fixed variable set but not used static analysis warning in example.
example.c:84:14: warning: variable ‘read’ set but not used [-Wunused-but-set-variable]
int err, read;
example.c:198:5: warning: Value stored to 'read' is never read [deadcode.DeadStores]
read = PREFIX(gzfread)(uncompr, uncomprLen, 1, file);
For gzseek, gzoffset, gzopen, adler32_combine, crc32_combine and crc32_combine_gen, export 32-bit and 64-bit versions for zlib-compatible api and only 64-bit version (without 64 suffix) for zlib-ng native api.
Fixed wrong 64-bit casting in deflatePrime potentially causing bits to be lost.
Arithmetic overflow: Using operator '<<' on a 4 byte value and then casting the result to a 8 byte value.
Cast the value to the wider type before calling operator '<<' to avoid overflow (io.2).
Arithmetic overflow: 32-bit value is shifted, then cast to 64-bit value.
Results might not be an expected value.
Matheus Castanho [Wed, 27 May 2020 13:06:09 +0000 (10:06 -0300)]
Add optimized slide_hash for POWER processors
This commit introduces a new slide_hash function that
uses VSX vector instructions to slide 8 hash elements at a time,
instead of just one as the standard code does.
Matheus Castanho [Mon, 25 May 2020 21:10:29 +0000 (18:10 -0300)]
Preparation for POWER optimizations
Add the scaffolding for future optimizations for POWER processors. Now
the build is capable of correctly detecting multiple processor
sub-architectures (ppc, ppc64 and ppc64le) and also if features
needed for the optimizations are available during build and runtime.
With these changes, adding a new optimized function for POWER should be
as simple as adding a new file under arch/power/, appending build
instructions to the build files and editing functable.c accordingly.
The UNALIGNED_OK flag is now also added by default for powerpc64le
targets.
Fixed multi-line assembly macro in UPDATE_HASH for MSVC when using ClangCl.
https://docs.microsoft.com/en-us/cpp/assembler/inline/defining-asm-blocks-as-c-macros
insert_string_tpl.h(44,5): error : cannot use more than one symbol in memory operand
insert_string_sse.c(28,13): message : expanded from macro 'UPDATE_HASH'
Fixed casting warnings in trees.c with count being int and freq being uint16_t.
Changed to use uint16_t for all counting variable types.
trees.c(431,45): warning C4244: '+=': conversion from 'int' to 'uint16_t', possible loss of data
trees.c(431,45): warning C4244: '+=': conversion from 'int' to 'uint16_t', possible loss of data
Fixed casting warnings in calls to put_short and put_short_msb.
deflate.c(845,32): warning C4244: 'function': conversion from 'unsigned int' to 'uint16_t', possible loss of data
deflate.c(894,50): warning C4244: 'function': conversion from 'unsigned int' to 'uint16_t', possible loss of data
Fixed casting warnings about copying len into pending buf, replaced with calls to put_short.
deflate.c(1413,45): warning C4244: '=': conversion from 'unsigned int' to 'unsigned char', possible loss of data
deflate.c(1414,50): warning C4244: '=': conversion from 'unsigned int' to 'unsigned char', possible loss of data
deflate.c(1415,46): warning C4244: '=': conversion from 'unsigned int' to 'unsigned char', possible loss of data
deflate.c(1416,51): warning C4244: '=': conversion from 'unsigned int' to 'unsigned char', possible loss of data
deflate_p.h(42,37): warning C4244: '=': conversion from 'unsigned int' to 'unsigned char', possible loss of data
deflate_p.h(43,42): warning C4244: '=': conversion from 'unsigned int' to 'unsigned char', possible loss of data
Fixed signedness warning in calls to __cpuid and cpuidex.
x86.c(29,22): warning C4057: 'function': 'int *' differs in indirection to slightly different base types from 'unsigned int [4]'
x86.c(43,24): warning C4057: 'function': 'int *' differs in indirection to slightly different base types from 'unsigned int [4]'
Added ability to set window bits for switchlevels.
Initialize deflateInit with first level which is necessary for deflate_quick testing where initial window size is set to 8k.
Fixed zero length stored block left open when using Z_SYNC_FLUSH. Moved toggling of block_open back to deflate_quick since zero length stored block doesn't emit end of block code.