mirror of
https://github.com/harfbuzz/harfbuzz.git
synced 2025-04-15 01:18:13 +00:00
[algs] Speed up fasthash for aligned uint64_t
This commit is contained in:
parent
fc80d20cb5
commit
b557a84123
1 changed files with 22 additions and 4 deletions
|
@ -297,10 +297,28 @@ static inline uint64_t fasthash64(const void *buf, size_t len, uint64_t seed)
|
|||
uint64_t h = seed ^ (len * m);
|
||||
uint64_t v;
|
||||
|
||||
while (pos != end) {
|
||||
v = pos++->v;
|
||||
h ^= mix(v);
|
||||
h *= m;
|
||||
#ifndef HB_OPTIMIZE_SIZE
|
||||
if (((uintptr_t) pos & 7) == 0)
|
||||
{
|
||||
while (pos != end)
|
||||
{
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wcast-align"
|
||||
v = * (const uint64_t *) (pos++);
|
||||
#pragma GCC diagnostic pop
|
||||
h ^= mix(v);
|
||||
h *= m;
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
while (pos != end)
|
||||
{
|
||||
v = pos++->v;
|
||||
h ^= mix(v);
|
||||
h *= m;
|
||||
}
|
||||
}
|
||||
|
||||
pos2 = (const unsigned char*)pos;
|
||||
|
|
Loading…
Add table
Reference in a new issue