diff options
Diffstat (limited to 'contrib/t1ha/t1ha.h')
-rw-r--r-- | contrib/t1ha/t1ha.h | 91 |
1 files changed, 0 insertions, 91 deletions
diff --git a/contrib/t1ha/t1ha.h b/contrib/t1ha/t1ha.h index 82e6e6a77..30c408c87 100644 --- a/contrib/t1ha/t1ha.h +++ b/contrib/t1ha/t1ha.h @@ -326,97 +326,6 @@ static __inline uint64_t t1ha(const void *data, size_t length, uint64_t seed) { return t1ha1_le(data, length, seed); } -/****************************************************************************** - * - * t1ha0 = 64-bit, JUST ONLY FASTER: - * - * - Provides fast-as-possible hashing for current CPU, including - * 32-bit systems and engaging the available hardware acceleration. - * - It is a facade that selects most quick-and-dirty hash - * for the current processor. For instance, on IA32 (x86) actual function - * will be selected in runtime, depending on current CPU capabilities - * - * BE CAREFUL!!! THIS IS MEANS: - * - * 1. The quality of hash is a subject for tradeoffs with performance. - * So, the quality and strength of t1ha0() may be lower than t1ha1(), - * especially on 32-bit targets, but then much faster. - * However, guaranteed that it passes all SMHasher tests. - * - * 2. No warranty that the hash result will be same for particular - * key on another machine or another version of libt1ha. - * - * Briefly, such hash-results and their derivatives, should be - * used only in runtime, but should not be persist or transferred - * over a network. - */ - -/* The little-endian variant for 32-bit CPU. */ -uint64_t t1ha0_32le(const void *data, size_t length, uint64_t seed); -/* The big-endian variant for 32-bit CPU. */ -uint64_t t1ha0_32be(const void *data, size_t length, uint64_t seed); - -/* Define T1HA0_AESNI_AVAILABLE to 0 for disable AES-NI support. */ -#ifndef T1HA0_AESNI_AVAILABLE -#if (defined(__ia32__) && (!defined(_M_IX86) || _MSC_VER > 1800)) - #if defined(__GNUC__) && \ - ((defined(__clang__) && (__clang_major__ >= 4 || (__clang_major__ >= 3 && __clang_minor__ >= 8))) || \ - ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8) || (__GNUC__ > 4))) - #define T1HA0_AESNI_AVAILABLE 1 - #else - #define T1HA0_AESNI_AVAILABLE 0 - #endif -#else -#define T1HA0_AESNI_AVAILABLE 0 -#endif -#endif /* T1HA0_AESNI_AVAILABLE */ - -/* Define T1HA0_RUNTIME_SELECT to 0 for disable dispatching t1ha0 at runtime. */ -#ifndef T1HA0_RUNTIME_SELECT -#if T1HA0_AESNI_AVAILABLE && !defined(__e2k__) -#define T1HA0_RUNTIME_SELECT 1 -#else -#define T1HA0_RUNTIME_SELECT 0 -#endif -#endif /* T1HA0_RUNTIME_SELECT */ - -#if T1HA0_AESNI_AVAILABLE -uint64_t t1ha0_ia32aes_noavx(const void *data, size_t length, uint64_t seed); -#endif /* T1HA0_AESNI_AVAILABLE */ - -#if T1HA0_RUNTIME_SELECT -#ifdef __ELF__ -/* ifunc/gnu_indirect_function will be used on ELF. - * Please see https://en.wikipedia.org/wiki/Executable_and_Linkable_Format */ -T1HA_API uint64_t t1ha0(const void *data, size_t length, uint64_t seed); -#else -/* Otherwise function pointer will be used. - * Unfortunately this may cause some overhead calling. */ -T1HA_API extern uint64_t (*t1ha0_funcptr)(const void *data, size_t length, - uint64_t seed); -static __inline uint64_t t1ha0(const void *data, size_t length, uint64_t seed) { - return t1ha0_funcptr(data, length, seed); -} -#endif /* __ELF__ */ - -#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ -static __inline uint64_t t1ha0(const void *data, size_t length, uint64_t seed) { -#if UINTPTR_MAX > 0xffffFFFFul || ULONG_MAX > 0xffffFFFFul - return t1ha1_be(data, length, seed); -#else - return t1ha0_32be(data, length, seed); -#endif -} -#else -static __inline uint64_t t1ha0(const void *data, size_t length, uint64_t seed) { -#if UINTPTR_MAX > 0xffffFFFFul || ULONG_MAX > 0xffffFFFFul - return t1ha1_le(data, length, seed); -#else - return t1ha0_32le(data, length, seed); -#endif -} -#endif /* !T1HA0_RUNTIME_SELECT */ - #ifdef __cplusplus } #endif |