Revert "[array] Remove hash specializations for bytes"
This reverts commit 213117317cefeb4e75d21c5c21e383309f116bb0.
diff --git a/src/hb-array.hh b/src/hb-array.hh
index d4dbefd..fbc98e7 100644
--- a/src/hb-array.hh
+++ b/src/hb-array.hh
@@ -424,6 +424,21 @@
return 0 == hb_memcmp (arrayZ, o.arrayZ, length);
}
+template <>
+inline uint32_t hb_array_t<const char>::hash () const {
+ uint32_t current = 0;
+ for (unsigned int i = 0; i < this->length; i++)
+ current = current * 31 + (uint32_t) (this->arrayZ[i] * 2654435761u);
+ return current;
+}
+template <>
+inline uint32_t hb_array_t<const unsigned char>::hash () const {
+ uint32_t current = 0;
+ for (unsigned int i = 0; i < this->length; i++)
+ current = current * 31 + (uint32_t) (this->arrayZ[i] * 2654435761u);
+ return current;
+}
+
typedef hb_array_t<const char> hb_bytes_t;
typedef hb_array_t<const unsigned char> hb_ubytes_t;