summaryrefslogtreecommitdiff
path: root/source/core/hash.h
diff options
context:
space:
mode:
Diffstat (limited to 'source/core/hash.h')
-rw-r--r--source/core/hash.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/source/core/hash.h b/source/core/hash.h
index 26450029d..ca6172fc7 100644
--- a/source/core/hash.h
+++ b/source/core/hash.h
@@ -34,7 +34,16 @@ namespace Slang
{
return GetHashCode(const_cast<const char *>(buffer));
}
-
+ inline int GetHashCode(const char * buffer, size_t numChars)
+ {
+ int hash = 0;
+ for (size_t i = 0; i < numChars; ++i)
+ {
+ hash = int(buffer[i]) + (hash << 6) + (hash << 16) - hash;
+ }
+ return hash;
+ }
+
template<int IsInt>
class Hash
{