Fix build.

This commit is contained in:
David Anderson 2013-08-25 14:04:01 -07:00
parent 0f52f6931b
commit 2c1a398292
4 changed files with 11 additions and 19 deletions

View File

@ -568,12 +568,12 @@ static inline uint32_t
HashInt64(int64_t key) HashInt64(int64_t key)
{ {
key = (~key) + (key << 18); // key = (key << 18) - key - 1; key = (~key) + (key << 18); // key = (key << 18) - key - 1;
key = key ^ (uint64(key) >> 31); key = key ^ (uint64_t(key) >> 31);
key = key * 21; // key = (key + (key << 2)) + (key << 4); key = key * 21; // key = (key + (key << 2)) + (key << 4);
key = key ^ (uint64(key) >> 11); key = key ^ (uint64_t(key) >> 11);
key = key + (key << 6); key = key + (key << 6);
key = key ^ (uint64(key) >> 22); key = key ^ (uint64_t(key) >> 22);
return uint32(key); return uint32_t(key);
} }
template <size_t Size> template <size_t Size>

View File

@ -48,18 +48,12 @@ namespace ke {
static const size_t kMallocAlignment = sizeof(void *) * 2; static const size_t kMallocAlignment = sizeof(void *) * 2;
typedef uint8_t uint8;
typedef int32_t int32;
typedef uint32_t uint32;
typedef int64_t int64;
typedef uint64_t uint64;
typedef uint8 * Address;
static const size_t kKB = 1024; static const size_t kKB = 1024;
static const size_t kMB = 1024 * kKB; static const size_t kMB = 1024 * kKB;
static const size_t kGB = 1024 * kMB; static const size_t kGB = 1024 * kMB;
typedef uint8_t * Address;
template <typename T> T template <typename T> T
ReturnAndVoid(T &t) ReturnAndVoid(T &t)
{ {

View File

@ -55,7 +55,7 @@ namespace SourceMod
// default. It is okay to use |T *|, the functions will still be looked up // default. It is okay to use |T *|, the functions will still be looked up
// on |T|. // on |T|.
template <typename T, typename KeyPolicy = T> template <typename T, typename KeyPolicy = T>
class NameHashSet : public SystemAllocatorPolicy class NameHashSet : public ke::SystemAllocatorPolicy
{ {
typedef detail::CharsAndLength CharsAndLength; typedef detail::CharsAndLength CharsAndLength;
@ -94,7 +94,7 @@ class NameHashSet : public SystemAllocatorPolicy
} }
}; };
typedef HashTable<Policy<T, KeyPolicy>, SystemAllocatorPolicy> Internal; typedef ke::HashTable<Policy<T, KeyPolicy>, ke::SystemAllocatorPolicy> Internal;
public: public:
NameHashSet() NameHashSet()

View File

@ -52,8 +52,6 @@
namespace SourceMod namespace SourceMod
{ {
using namespace ke;
namespace detail namespace detail
{ {
class CharsAndLength class CharsAndLength
@ -89,7 +87,7 @@ namespace detail
struct StringHashMapPolicy struct StringHashMapPolicy
{ {
static inline bool matches(const CharsAndLength &lookup, const AString &key) { static inline bool matches(const CharsAndLength &lookup, const ke::AString &key) {
return lookup.length() == key.length() && return lookup.length() == key.length() &&
memcmp(lookup.chars(), key.chars(), key.length()) == 0; memcmp(lookup.chars(), key.chars(), key.length()) == 0;
} }
@ -103,11 +101,11 @@ template <typename T>
class StringHashMap class StringHashMap
{ {
typedef detail::CharsAndLength CharsAndLength; typedef detail::CharsAndLength CharsAndLength;
typedef HashMap<AString, T, detail::StringHashMapPolicy> Internal; typedef ke::HashMap<ke::AString, T, detail::StringHashMapPolicy> Internal;
public: public:
StringHashMap() StringHashMap()
: internal_(SystemAllocatorPolicy()), : internal_(ke::SystemAllocatorPolicy()),
memory_used_(0) memory_used_(0)
{ {
if (!internal_.init()) if (!internal_.init())