From 3c7e1be0098f963225afd0ebe83340a991392892 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Thu, 17 Jan 2019 17:50:48 -0500 Subject: Feature/hash for source identity (#786) * * Added COMMAND_LINE_SIMPLE test type * Made how spawning works controllable by paramter/type SpawnType * Made break-outside-loop and global-uniform run command line slangc * calcRelativePath -> calcCombinedPath * Add 64 bit version of GetHash. * Add support for Hash based mode for CacheFileSystem. --- source/core/hash.h | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'source/core') diff --git a/source/core/hash.h b/source/core/hash.h index ca6172fc7..fc0bca737 100644 --- a/source/core/hash.h +++ b/source/core/hash.h @@ -43,7 +43,18 @@ namespace Slang } return hash; } - + + inline uint64_t GetHashCode64(const char * buffer, size_t numChars) + { + // Use uints because hash requires wrap around behavior and int is undefined on over/underflows + uint64_t hash = 0; + for (size_t i = 0; i < numChars; ++i) + { + hash = uint64_t(int64_t(buffer[i])) + (hash << 6) + (hash << 16) - hash; + } + return hash; + } + template class Hash { @@ -111,4 +122,4 @@ namespace Slang } } -#endif \ No newline at end of file +#endif -- cgit v1.2.3