liblzma: Define CRC_USE_IFUNC in crc_common.h.
When ifunc is supported, we can define a simpler macro instead of repeating the more complex check in both crc32_fast.c and crc64_fast.c.
This commit is contained in:
parent
f1cd9d7194
commit
a3ebc2c516
|
@ -272,8 +272,7 @@ crc32_dispatch(const uint8_t *buf, size_t size, uint32_t crc)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if defined(CRC_GENERIC) && defined(CRC_CLMUL) \
|
#ifdef CRC_USE_IFUNC
|
||||||
&& defined(HAVE_FUNC_ATTRIBUTE_IFUNC)
|
|
||||||
extern LZMA_API(uint32_t)
|
extern LZMA_API(uint32_t)
|
||||||
lzma_crc32(const uint8_t *buf, size_t size, uint32_t crc)
|
lzma_crc32(const uint8_t *buf, size_t size, uint32_t crc)
|
||||||
__attribute__((__ifunc__("crc32_resolve")));
|
__attribute__((__ifunc__("crc32_resolve")));
|
||||||
|
|
|
@ -274,8 +274,7 @@ crc64_dispatch(const uint8_t *buf, size_t size, uint64_t crc)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if defined(CRC_GENERIC) && defined(CRC_CLMUL) \
|
#ifdef CRC_USE_IFUNC
|
||||||
&& defined(HAVE_FUNC_ATTRIBUTE_IFUNC)
|
|
||||||
extern LZMA_API(uint64_t)
|
extern LZMA_API(uint64_t)
|
||||||
lzma_crc64(const uint8_t *buf, size_t size, uint64_t crc)
|
lzma_crc64(const uint8_t *buf, size_t size, uint64_t crc)
|
||||||
__attribute__((__ifunc__("crc64_resolve")));
|
__attribute__((__ifunc__("crc64_resolve")));
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
|
|
||||||
#undef CRC_GENERIC
|
#undef CRC_GENERIC
|
||||||
#undef CRC_CLMUL
|
#undef CRC_CLMUL
|
||||||
|
#undef CRC_USE_IFUNC
|
||||||
#undef CRC_USE_GENERIC_FOR_SMALL_INPUTS
|
#undef CRC_USE_GENERIC_FOR_SMALL_INPUTS
|
||||||
|
|
||||||
// If CLMUL cannot be used then only the generic slice-by-four is built.
|
// If CLMUL cannot be used then only the generic slice-by-four is built.
|
||||||
|
@ -54,6 +55,10 @@
|
||||||
# define CRC_GENERIC 1
|
# define CRC_GENERIC 1
|
||||||
# define CRC_CLMUL 1
|
# define CRC_CLMUL 1
|
||||||
|
|
||||||
|
# ifdef HAVE_FUNC_ATTRIBUTE_IFUNC
|
||||||
|
# define CRC_USE_IFUNC 1
|
||||||
|
# endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
// The generic code is much faster with 1-8-byte inputs and has
|
// The generic code is much faster with 1-8-byte inputs and has
|
||||||
// similar performance up to 16 bytes at least in microbenchmarks
|
// similar performance up to 16 bytes at least in microbenchmarks
|
||||||
|
|
Loading…
Reference in New Issue