diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2019-01-17 17:50:48 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-01-17 17:50:48 -0500 |
| commit | 3c7e1be0098f963225afd0ebe83340a991392892 (patch) | |
| tree | 4be05c44125c3378cb5278cd8f7615fc280ea0fc /source/core | |
| parent | 668078ac8be89e55c8e13ac429c4b0e63fb604dc (diff) | |
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.
Diffstat (limited to 'source/core')
| -rw-r--r-- | source/core/hash.h | 15 |
1 files changed, 13 insertions, 2 deletions
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<int IsInt> class Hash { @@ -111,4 +122,4 @@ namespace Slang } } -#endif
\ No newline at end of file +#endif |
