diff --git a/2022/include/pjwhash-inline.h b/2022/include/pjwhash-inline.h index f8647cf..75c2bcb 100644 --- a/2022/include/pjwhash-inline.h +++ b/2022/include/pjwhash-inline.h @@ -24,12 +24,13 @@ #define _pjw_inline static inline #endif -_pjw_inline unsigned int pjwhash(const char* str, uint length) +_pjw_inline unsigned int pjwhash(const void* key, uint length) { uint hash = 0, high; + const u8 *k = key; - for (uint i = 0; i < length; ++str, ++i) { - hash = (hash << ONE_EIGHTH) + *str; + for (uint i = 0; i < length; ++k, ++i) { + hash = (hash << ONE_EIGHTH) + *k; high = hash & HIGH_BITS; if (high != 0) { hash ^= high >> THREE_QUARTERS; diff --git a/2022/include/pjwhash.h b/2022/include/pjwhash.h index 9fbe47d..4a33d5a 100644 --- a/2022/include/pjwhash.h +++ b/2022/include/pjwhash.h @@ -15,6 +15,6 @@ #include "bits.h" -extern unsigned int pjwhash(const char* str, uint length); +extern unsigned int pjwhash (const void* key, uint length) #endif /* _PJWHASH_H */