7419c22016-07-03Arne Goedeke #include "global.h" #include "string.h" #ifdef __i386__ ATTRIBUTE((fastcall)) #endif ATTRIBUTE((hot))
d559142017-07-17Martin Nilsson PMOD_EXPORT UINT64 low_hashmem_siphash24( const void *s, size_t len, size_t nbytes, UINT64 key );
7419c22016-07-03Arne Goedeke  #if PIKE_BYTEORDER == 1234 ATTRIBUTE((unused))
d559142017-07-17Martin Nilsson static inline UINT64 low_hashmem_siphash24_uint32( const unsigned INT32 *in, size_t len, UINT64 key ) {
7419c22016-07-03Arne Goedeke  return low_hashmem_siphash24(in, len*4, len*4, key); } ATTRIBUTE((unused))
d559142017-07-17Martin Nilsson static inline UINT64 low_hashmem_siphash24_uint16( const unsigned INT16 *in, size_t len, UINT64 key ) {
7419c22016-07-03Arne Goedeke  return low_hashmem_siphash24(in, len*2, len*2, key); } #else ATTRIBUTE((unused)) #ifdef __i386__ ATTRIBUTE((fastcall)) #endif ATTRIBUTE((hot))
d559142017-07-17Martin Nilsson PMOD_EXPORT UINT64 low_hashmem_siphash24_uint32( const unsigned INT32 *in, size_t len, UINT64 key );
7419c22016-07-03Arne Goedeke  #ifdef __i386__ ATTRIBUTE((fastcall)) #endif ATTRIBUTE((hot))
d559142017-07-17Martin Nilsson PMOD_EXPORT UINT64 low_hashmem_siphash24_uint16( const unsigned INT16 *in, size_t len, UINT64 key );
7419c22016-07-03Arne Goedeke #endif ATTRIBUTE((unused))
d559142017-07-17Martin Nilsson static inline UINT64 pike_string_siphash24(const struct pike_string *s, UINT64 key) {
7419c22016-07-03Arne Goedeke  if (s->size_shift == eightbit) { return low_hashmem_siphash24(STR0(s), s->len, s->len, key); } else if (s->size_shift == sixteenbit) { return low_hashmem_siphash24_uint16(STR1(s), s->len, key); } else { return low_hashmem_siphash24_uint32((unsigned INT32*)STR2(s), s->len, key); } }