Commit Graph

64 Commits

Author SHA1 Message Date
Vladislav Shchapov
fe0a6407da Explicitly indicate functions are conditionally dispatched
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2024-03-06 23:32:15 +01:00
Hans Kristian Rosbach
4e132cc0ec Move adler32 C fallbacks to arch/generic 2024-01-19 15:22:34 +01:00
Cameron Cawley
1ab443812a Use size_t instead of uint64_t for len in all adler32 functions 2023-01-22 00:58:12 +01:00
Nathan Moinvaziri
2ca4a77761 Used fixed width uint8_t for crc32 and adler32 function declarations. 2022-06-24 15:12:00 +02:00
Nathan Moinvaziri
5f370cd887 Use uint64_t instead of size_t for len in adler32 to be consistent with crc32. 2022-06-24 15:12:00 +02:00
Nathan Moinvaziri
ab0a6d9fa7 Remove zutil.h includes from many files to prevent zlib.h being included. 2022-01-29 17:03:22 +01:00
Nathan Moinvaziri
330445c51b Reuse adler32_len_64 in adler32_c. 2021-12-02 09:27:21 +01:00
Nathan Moinvaziri
1f10aa4e29 Rename ZEXPORT and ZEXTERN for consistency. 2020-08-31 12:33:16 +02:00
Nathan Moinvaziri
7cffba4dd6 Rename ZLIB_INTERNAL to Z_INTERNAL for consistency. 2020-08-31 12:33:16 +02:00
Nathan Moinvaziri
193d8fd7df Remove NO_DIVIDE from adler32. 2020-08-16 17:37:04 +02:00
Nathan Moinvaziri
d5d1f7e81b Fixed extra symbols added to ABI when zlib-compat specified. 2020-08-02 18:32:25 +02:00
Mika Lindqvist
edb35970fc Style cleanup.
* Remove space between function name and opening parenthesis
* Remove space closing parenthesis of cast and variable name
2020-08-02 18:20:03 +02:00
Mika Lindqvist
49b3836b50 Fix signature of adler32(), adler32_combine(), adler32_combine64() and adler32_z() in compat mode.
* See #700
2020-08-02 18:20:03 +02:00
Matheus Castanho
7e63f5237f Move DO* macro definitions to adler32_p.h
Add new generic definitions of DO* macros used by adler32 algorithms to
adler32_p.h to allow reuse by other adler32 implementations.
2020-06-25 15:29:54 +02:00
Nathan Moinvaziri
00b1a86f91 Add UNLIKELY to first 3 branches in adler32 variants. 2020-06-08 21:17:18 +02:00
Nathan Moinvaziri
6dcc7bf815 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. 2020-06-08 21:14:07 +02:00
Pavel P
762068fdc6 Remove cvs keywords 2020-03-17 15:26:47 +01:00
Sebastian Pop
098f73a45e cleanup arm/adler32_neon.c code 2019-04-04 10:13:26 +02:00
Sebastian Pop
3ac4f5de06 only call NEON adler32 for more than 16 bytes
improves performance of inflate by up to 6% on an A-73 Hikey running at 2.36 GHz
when executing the chromium benchmark on the snappy data set.  In a few cases
inflate is slower by up to 0.8%.  Overall performance of inflate is better by
about 0.3%.
2019-04-04 10:13:26 +02:00
Hans Kristian Rosbach
18d2622939 Replace the UNROLL_LESS define with UNROLL_MORE, making UNROLL_LESS the default.
Performance benchmarks have so far not shown that any platform benefits from UNROLL_MORE,
although this might be beneficial on older compilers/cpus or for compiling without optimizations.

The extra UNROLL_MORE code should be considered for removal since it is never enabled by us
and will likely only serve to confuse and contribute to bitrot.
2019-01-21 10:25:50 +01:00
Sebastian Pop
9992d3b599 fix #187: remove errors exposed by undefined behavior sanitizer
Move decrement in loop to avoid the following errors:
adler32.c:91:19: runtime error: unsigned integer overflow: 0 - 1 cannot be represented in type 'size_t' (aka 'unsigned long')
adler32.c:136:19: runtime error: unsigned integer overflow: 0 - 1 cannot be represented in type 'size_t' (aka 'unsigned long')
inflate.c:972:32: runtime error: unsigned integer overflow: 0 - 1 cannot be represented in type 'unsigned int'

Fix the following bugs as recommended by Mika Lindqvist:
arch/x86/deflate_quick.c:233:22: runtime error: unsigned integer overflow: 0 - 1 cannot be represented in type 'unsigned int'
arch/x86/fill_window_sse.c:52:28: runtime error: unsigned integer overflow: 1 - 8192 cannot be represented in type 'unsigned int'
2018-09-20 08:09:07 +02:00
Mika Lindqvist
df1fd1567f Move private defines from zconf.h and zconf-ng.h to zbuild.h
* move definition of z_size_t to zbuild.h
2018-03-22 10:18:27 +01:00
Hans Kristian Rosbach
f5e888a6a6 Add function prefix (zng_) to all exported functions to allow zlib-ng
to co-exist in an application that has been linked to something that
depends on stock zlib. Previously, that would cause random problems
since there is no way to guarantee what zlib version is being used
for each dynamically linked function.

Add the corresponding zlib-ng.h.

Tests, example and minigzip will not compile before they have been
adapted to use the correct functions as well.
Either duplicate them, so we have minigzip-ng.c for example, or add
compile-time detection in the source code.
2018-01-31 10:45:29 +01:00
Mika Lindqvist
5adc2052eb Lazily initialize functable members. (#108)
- Split functableInit() function as separate functions for each functable member, so we don't need to initialize full functable in multiple places in the zlib-ng code, or to check for NULL on every invocation.
- Optimized function for each functable member is detected on first invocation and the functable item is updated for subsequent invocations.
- Remove NULL check in adler32() and adler32_z() as it is no longer needed.
2017-05-03 19:14:57 +02:00
Hans Kristian Rosbach
a7c7119009 - Add adler32 to functable
- Add missing call to functableinit from inflateinit
- Fix external direct calls to adler32 functions without calling functableinit
2017-04-24 12:47:24 +02:00
Mika Lindqvist
f3b151549f ARM optimizations part 2 (#107)
*  add adler32_neon to main dependency checking and ARM/Windows Makefile
*  split non-optimized adler32 to adler32_c so we can test/compare both without recompiling.
*  add detection of default floating point ABI in gcc
    NOTE: This should avoid build error when gcc supports both ABIs but header for just one ABI is installed.
2017-04-24 11:22:11 +02:00
Adenilson Cavalcanti
ec02ecf104 Implementing NEON-ized Adler32 checksum (#102)
The checksum is calculated in the uncompressed PNG data and can be
made much faster by using SIMD. Tests in ARMv8 yielded an improvement
of about 3x (e.g. walltime was 350ms x 125ms for a 4096x4096 bytes
executed 30 times).

This yields an improvement in image decoding in Chromium around 18%
(see https://bugs.chromium.org/p/chromium/issues/detail?id=688601).
2017-04-22 11:41:47 +02:00
Mark Adler
2a51c84f6c zlib 1.2.9 2017-02-09 11:39:40 +01:00
Mark Adler
73ba5ea69e Add crc32_z() and adler32_z() functions with size_t lengths. 2017-02-09 11:21:35 +01:00
Mika Lindqvist
602531cf3d Replace Z_NULL with NULL. Fix incorrect uses of NULL/Z_NULL. 2017-01-31 10:53:22 +01:00
Mika Lindqvist
9c3a280877 Type cleanup. 2015-12-14 11:00:22 +02:00
Mark Adler
46c21b18e0 Clean up portability for shifts and integer sizes. 2015-11-03 19:12:42 +01:00
Hans Kristian Rosbach
d9b63c782f Style cleanup for adler/crc code 2015-05-25 23:03:25 +02:00
Daniel Axtens
24cfc4d7bb Kill Byte and Bytef
Signed-off-by: Daniel Axtens <dja@axtens.net>

Conflicts:
	adler32.c
	compress.c
	deflate.c
	inflate.c
	match.c
	test/example.c
	uncompr.c
	zlib.h
2015-05-17 18:11:59 +02:00
Hans Kristian Rosbach
abae9eefc4 Convert remaining K&R function declarations to ANSI-C declarations. 2015-05-12 18:54:20 +02:00
Hans Kristian Rosbach
d376be237b Minor cleanup of includefiles relating mostly to stdint.h 2015-05-12 16:03:14 +02:00
Hans Kristian Rosbach
0cd2fda2a3 Combine CRC32_UNROLL_LESS and ADLER32_UNROLL_LESS into UNROLL_LESS 2015-05-12 11:48:14 +02:00
Daniel Axtens
f648a24be0 adler32: unsigned long -> uint32_t
Authored by Danial Axtens, with some minor merge fixups by Hans Kristian Rosbach.

Conflicts:
	adler32.c
	zlib.h
	zutil.h
2015-05-11 21:06:04 +02:00
Daniel Axtens
22209eea3c adler32: local -> static
Signed-off-by: Daniel Axtens <dja@axtens.net>

Conflicts:
	adler32.c
2015-05-11 21:01:08 +02:00
hansr
84002037ee Rewrite K&R-style function prototypes to ANSI-C-style.
Only internal functions, no exported functions in this commit.
2014-10-18 22:49:16 +02:00
hansr
c4963b5ebf Remove FAR variants of variables ushf, schf, Posf, Bytef, charf,
intf, uIntf and uLongf
2014-10-16 15:32:17 +02:00
hansr
3f8e26e0b7 Remove workarounds for non-ANSI-C compatible compilers (Part 2)
-Removing usage of OF() definition
2014-10-12 22:57:27 +02:00
Jim Kukunas
fad00ea21a Add preprocessor define to tune Adler32 loop unrolling.
Excessive loop unrolling is detrimental to performance. This patch
adds a preprocessor define, ADLER32_UNROLL_LESS, to reduce unrolling
factor from 16 to 8.

Updates configure script to set as default on x86
2014-01-17 13:12:47 -08:00
Mark Adler
10daf0d4d7 zlib 1.2.5.1 2011-09-11 11:04:49 -07:00
Mark Adler
f6194ef39a zlib 1.2.3.4 2011-09-09 23:26:40 -07:00
Mark Adler
639be99788 zlib 1.2.3.3 2011-09-09 23:26:29 -07:00
Mark Adler
0484693e17 zlib 1.2.2.2 2011-09-09 23:24:33 -07:00
Mark Adler
9811b53dd9 zlib 1.2.2.1 2011-09-09 23:24:24 -07:00
Mark Adler
7a33a861d1 zlib 1.2.1 2011-09-09 23:23:27 -07:00
Mark Adler
a2506218cd zlib 1.2.0.8 2011-09-09 23:23:14 -07:00