|
|
|
@ -458,21 +458,9 @@ inline uint32_t hb_array_t<const char>::hash () const |
|
|
|
|
{ |
|
|
|
|
// FNV-1a hash function
|
|
|
|
|
uint32_t current = /*cbf29ce4*/0x84222325; |
|
|
|
|
unsigned i = 0; |
|
|
|
|
|
|
|
|
|
#if defined(__OPTIMIZE__) && !defined(HB_NO_PACKED) && \ |
|
|
|
|
((defined(__GNUC__) && __GNUC__ >= 5) || defined(__clang__)) |
|
|
|
|
struct __attribute__((packed)) packed_uint32_t { uint32_t v; }; |
|
|
|
|
for (; i + 4 <= this->length; i += 4) |
|
|
|
|
{ |
|
|
|
|
current = current ^ hb_hash ((uint32_t) ((const packed_uint32_t *) &this->arrayZ[i])->v); |
|
|
|
|
current = current * 16777619; |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
for (; i < this->length; i++) |
|
|
|
|
for (auto &v : *this) |
|
|
|
|
{ |
|
|
|
|
current = current ^ hb_hash (this->arrayZ[i]); |
|
|
|
|
current = current ^ v; |
|
|
|
|
current = current * 16777619; |
|
|
|
|
} |
|
|
|
|
return current; |
|
|
|
@ -483,21 +471,9 @@ inline uint32_t hb_array_t<const unsigned char>::hash () const |
|
|
|
|
{ |
|
|
|
|
// FNV-1a hash function
|
|
|
|
|
uint32_t current = /*cbf29ce4*/0x84222325; |
|
|
|
|
unsigned i = 0; |
|
|
|
|
|
|
|
|
|
#if defined(__OPTIMIZE__) && !defined(HB_NO_PACKED) && \ |
|
|
|
|
((defined(__GNUC__) && __GNUC__ >= 5) || defined(__clang__)) |
|
|
|
|
struct __attribute__((packed)) packed_uint32_t { uint32_t v; }; |
|
|
|
|
for (; i + 4 <= this->length; i += 4) |
|
|
|
|
{ |
|
|
|
|
current = current ^ hb_hash ((uint32_t) ((const packed_uint32_t *) &this->arrayZ[i])->v); |
|
|
|
|
current = current * 16777619; |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
for (; i < this->length; i++) |
|
|
|
|
for (auto &v : *this) |
|
|
|
|
{ |
|
|
|
|
current = current ^ hb_hash (this->arrayZ[i]); |
|
|
|
|
current = current ^ v; |
|
|
|
|
current = current * 16777619; |
|
|
|
|
} |
|
|
|
|
return current; |
|
|
|
|