Branch: Tag:

2011-05-15

2011-05-15 03:32:44 by Per Hedbor <ph@opera.com>

Implemented a version of hashmem that uses the CRC32 instructions in modern x86 CPU:s. This is about 3x faster than the pure C-version.

101:   /*** Main string hash function ***/      #define StrHash(s,len) low_do_hash(s,len,0) + #define low_do_hash(STR,LEN,SHIFT) hashmem( (STR), (LEN)<<(SHIFT), HASH_PREFIX<<(SHIFT) ) + #define do_hash(STR) low_do_hash(STR->str,STR->len,STR->size_shift)    - static size_t low_do_hash(const void *s, -  ptrdiff_t len__, -  int size_shift) - { -  size_t h; -  DO_HASHMEM(h, s, len__<<size_shift, HASH_PREFIX<<size_shift); -  return h; - } +     - static INLINE size_t do_hash(struct pike_string *s) - { -  return low_do_hash(s->str, s->len, s->size_shift); - } -  -  +    static INLINE int find_magnitude1(const p_wchar1 *s, ptrdiff_t len)   {    const p_wchar1 *e=s+len;