diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2019-04-19 11:42:58 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2019-04-19 11:42:58 +0200 |
commit | 6640f397f15b4179a7283b27c060d3f4f7c9917a (patch) | |
tree | 253f8d6f1b38ec07eade7e249472500174324699 /thirdparty/thekla_atlas/nvcore/Hash.h | |
parent | 1b3ea697c5dcbbb2feb0f96204de257532edaf0c (diff) |
Drop unused thekla_atlas dependency
Since f12cb82 @reduz dropped the use of the thirdparty thekla_atlas
library, which is replaced by xatlas.
Fixes #28180.
Fixes #28182.
Diffstat (limited to 'thirdparty/thekla_atlas/nvcore/Hash.h')
-rw-r--r-- | thirdparty/thekla_atlas/nvcore/Hash.h | 83 |
1 files changed, 0 insertions, 83 deletions
diff --git a/thirdparty/thekla_atlas/nvcore/Hash.h b/thirdparty/thekla_atlas/nvcore/Hash.h deleted file mode 100644 index a8b0b2c63b..0000000000 --- a/thirdparty/thekla_atlas/nvcore/Hash.h +++ /dev/null @@ -1,83 +0,0 @@ -// This code is in the public domain -- Ignacio Castaño <castano@gmail.com> - -#pragma once -#ifndef NV_CORE_HASH_H -#define NV_CORE_HASH_H - -#include "nvcore.h" - -namespace nv -{ - inline uint sdbmHash(const void * data_in, uint size, uint h = 5381) - { - const uint8 * data = (const uint8 *) data_in; - uint i = 0; - while (i < size) { - h = (h << 16) + (h << 6) - h + (uint) data[i++]; - } - return h; - } - - // Note that this hash does not handle NaN properly. - inline uint sdbmFloatHash(const float * f, uint count, uint h = 5381) - { - for (uint i = 0; i < count; i++) { - //nvDebugCheck(nv::isFinite(*f)); - union { float f; uint32 i; } x = { f[i] }; - if (x.i == 0x80000000) x.i = 0; - h = sdbmHash(&x, 4, h); - } - return h; - } - - - template <typename T> - inline uint hash(const T & t, uint h = 5381) - { - return sdbmHash(&t, sizeof(T), h); - } - - template <> - inline uint hash(const float & f, uint h) - { - return sdbmFloatHash(&f, 1, h); - } - - - // Functors for hash table: - template <typename Key> struct Hash - { - uint operator()(const Key & k) const { - return hash(k); - } - }; - - template <typename Key> struct Equal - { - bool operator()(const Key & k0, const Key & k1) const { - return k0 == k1; - } - }; - - - // @@ Move to Utils.h? - template <typename T1, typename T2> - struct Pair { - T1 first; - T2 second; - }; - - template <typename T1, typename T2> - bool operator==(const Pair<T1,T2> & p0, const Pair<T1,T2> & p1) { - return p0.first == p1.first && p0.second == p1.second; - } - - template <typename T1, typename T2> - uint hash(const Pair<T1,T2> & p, uint h = 5381) { - return hash(p.second, hash(p.first)); - } - - -} // nv namespace - -#endif // NV_CORE_HASH_H |