diff options
author | Jan Vorlicek <janvorli@microsoft.com> | 2015-10-17 11:18:37 +0300 |
---|---|---|
committer | Jan Vorlicek <janvorli@microsoft.com> | 2015-10-24 18:38:19 +0300 |
commit | b8ee1855645d427fd9a1ad17f9270340a42f96a0 (patch) | |
tree | 5d66f0d662b5c7f8441e356f2e157796cf5656e7 /src/Native/Runtime/shash.h | |
parent | 86b0cc9a82ae0655eb334ca4aacf9a384a05b89b (diff) |
Enable compilation of the runtime on Linux
This change enables compilation of the runtime excluding the PAL
layer on Linux.
Most of the changes are just to make it build with clang that's
more strict w.r.t. the C++11 standard.
In addition to that, I have removed our implementation of the
new / delete operators and replaced all calls to new in the
runtime by new (nothrow).
Diffstat (limited to 'src/Native/Runtime/shash.h')
-rw-r--r-- | src/Native/Runtime/shash.h | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/src/Native/Runtime/shash.h b/src/Native/Runtime/shash.h index b36b2f372..658df0698 100644 --- a/src/Native/Runtime/shash.h +++ b/src/Native/Runtime/shash.h @@ -125,6 +125,8 @@ class SHash : public TRAITS class KeyIndex; friend class KeyIndex; + class Iterator; + class KeyIterator; public: // explicitly declare local typedefs for these traits types, otherwise @@ -134,9 +136,6 @@ class SHash : public TRAITS typedef typename TRAITS::key_t key_t; typedef typename TRAITS::count_t count_t; - class Iterator; - class KeyIterator; - // Constructor/destructor. SHash tables always start out empty, with no // allocation overhead. Call Reallocate to prime with an initial size if // desired. @@ -350,7 +349,7 @@ private: void First() { if (m_index < m_tableSize) - if (IsNull(m_table[m_index]) || IsDeleted(m_table[m_index])) + if (TRAITS::IsNull(m_table[m_index]) || TRAITS::IsDeleted(m_table[m_index])) Next(); } @@ -364,7 +363,7 @@ private: m_index++; if (m_index >= m_tableSize) break; - if (!IsNull(m_table[m_index]) && !IsDeleted(m_table[m_index])) + if (!TRAITS::IsNull(m_table[m_index]) && !TRAITS::IsDeleted(m_table[m_index])) break; } } @@ -417,14 +416,14 @@ private: m_key = key; count_t hash = Hash(key); - m_index = hash % m_tableSize; + TRAITS::m_index = hash % m_tableSize; m_increment = (hash % (m_tableSize-1)) + 1; // Find first valid element - if (IsNull(m_table[m_index])) - m_index = m_tableSize; - else if (IsDeleted(m_table[m_index]) - || !Equals(m_key, GetKey(m_table[m_index]))) + if (IsNull(m_table[TRAITS::m_index])) + TRAITS::m_index = m_tableSize; + else if (IsDeleted(m_table[TRAITS::m_index]) + || !Equals(m_key, GetKey(m_table[TRAITS::m_index]))) Next(); } } @@ -433,18 +432,18 @@ private: { while (true) { - m_index += m_increment; - if (m_index >= m_tableSize) - m_index -= m_tableSize; + TRAITS::m_index += m_increment; + if (TRAITS::m_index >= m_tableSize) + TRAITS::m_index -= m_tableSize; - if (IsNull(m_table[m_index])) + if (IsNull(m_table[TRAITS::m_index])) { - m_index = m_tableSize; + TRAITS::m_index = m_tableSize; break; } - if (!IsDeleted(m_table[m_index]) - && Equals(m_key, GetKey(m_table[m_index]))) + if (!IsDeleted(m_table[TRAITS::m_index]) + && Equals(m_key, GetKey(m_table[TRAITS::m_index]))) { break; } |