mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-24 00:11:14 +01:00
[algs] Speed up fasthash for aligned uint64_t
This commit is contained in:
1 parent
fc80d20cb5
commit
b557a84123
1 file changed
+22
-4
+22
-4
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user