mirror of
https://github.com/GerbilSoft/zlib-ng.git
synced 2025-06-18 11:35:35 -04:00

- Remove obsolete checks - Fix checks that are inconsistent - Stop compiling compare256/longest_match variants that never gets called - Improve how the generic compare256 functions are handled. - Allow overriding OPTIMAL_CMP This simplifies the code and avoids having a lot of code in the compiled library than can never get executed.
32 lines
899 B
C
32 lines
899 B
C
/* compare256.c -- 256 byte memory comparison with match length return
|
|
* Copyright (C) 2020 Nathan Moinvaziri
|
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
|
*/
|
|
|
|
#include "zbuild.h"
|
|
#include "compare256_p.h"
|
|
|
|
// Set optimal COMPARE256 function variant
|
|
#if OPTIMAL_CMP == 8
|
|
# define COMPARE256 compare256_8
|
|
#elif defined(HAVE_BUILTIN_CTZLL)
|
|
# define COMPARE256 compare256_64
|
|
#elif defined(HAVE_BUILTIN_CTZ)
|
|
# define COMPARE256 compare256_32
|
|
#else
|
|
# define COMPARE256 compare256_16
|
|
#endif
|
|
|
|
Z_INTERNAL uint32_t compare256_c(const uint8_t *src0, const uint8_t *src1) {
|
|
return COMPARE256(src0, src1);
|
|
}
|
|
|
|
// Generate longest_match_c
|
|
#define LONGEST_MATCH longest_match_c
|
|
#include "match_tpl.h"
|
|
|
|
// Generate longest_match_slow_c
|
|
#define LONGEST_MATCH_SLOW
|
|
#define LONGEST_MATCH longest_match_slow_c
|
|
#include "match_tpl.h"
|