Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/kernel/gen_system')
-rw-r--r--source/kernel/gen_system/GEN_HashedPtr.cpp8
-rw-r--r--source/kernel/gen_system/GEN_HashedPtr.h1
-rw-r--r--source/kernel/gen_system/GEN_Map.h31
-rw-r--r--source/kernel/gen_system/Makefile1
4 files changed, 36 insertions, 5 deletions
diff --git a/source/kernel/gen_system/GEN_HashedPtr.cpp b/source/kernel/gen_system/GEN_HashedPtr.cpp
index 49ccb252246..6dbed1fb7a8 100644
--- a/source/kernel/gen_system/GEN_HashedPtr.cpp
+++ b/source/kernel/gen_system/GEN_HashedPtr.cpp
@@ -33,6 +33,8 @@
#include <config.h>
#endif
+#include "BLO_sys_types.h" // for intptr_t support
+
//
// Build hash index from pointer. Even though the final result
// is a 32-bit integer, use all the bits of the pointer as long
@@ -41,11 +43,7 @@
unsigned int GEN_Hash(void * inDWord)
{
-#if defined(_WIN64)
- unsigned __int64 key = (unsigned __int64)inDWord;
-#else
- unsigned long key = (unsigned long)inDWord;
-#endif
+ uintptr_t key = (uintptr_t)inDWord;
key += ~(key << 16);
key ^= (key >> 5);
diff --git a/source/kernel/gen_system/GEN_HashedPtr.h b/source/kernel/gen_system/GEN_HashedPtr.h
index 777ec76e067..13faa5f227b 100644
--- a/source/kernel/gen_system/GEN_HashedPtr.h
+++ b/source/kernel/gen_system/GEN_HashedPtr.h
@@ -39,6 +39,7 @@ public:
GEN_HashedPtr(void* val) : m_valptr(val) {};
unsigned int hash() const { return GEN_Hash(m_valptr);};
inline friend bool operator ==(const GEN_HashedPtr & rhs, const GEN_HashedPtr & lhs) { return rhs.m_valptr == lhs.m_valptr;};
+ void *getValue() const { return m_valptr; }
};
#endif //__GEN_HASHEDPTR
diff --git a/source/kernel/gen_system/GEN_Map.h b/source/kernel/gen_system/GEN_Map.h
index f9c14800499..88c79293223 100644
--- a/source/kernel/gen_system/GEN_Map.h
+++ b/source/kernel/gen_system/GEN_Map.h
@@ -50,6 +50,19 @@ public:
m_buckets[i] = 0;
}
}
+
+ GEN_Map(const GEN_Map& map)
+ {
+ m_num_buckets = map.m_num_buckets;
+ m_buckets = new Entry *[m_num_buckets];
+
+ for (int i = 0; i < m_num_buckets; ++i) {
+ m_buckets[i] = 0;
+
+ for(Entry *entry = map.m_buckets[i]; entry; entry=entry->m_next)
+ insert(entry->m_key, entry->m_value);
+ }
+ }
int size() {
int count=0;
@@ -82,6 +95,24 @@ public:
}
return 0;
}
+
+ Key* getKey(int index) {
+ int count=0;
+ for (int i=0;i<m_num_buckets;i++)
+ {
+ Entry* bucket = m_buckets[i];
+ while(bucket)
+ {
+ if (count==index)
+ {
+ return &bucket->m_key;
+ }
+ bucket = bucket->m_next;
+ count++;
+ }
+ }
+ return 0;
+ }
void clear() {
for (int i = 0; i < m_num_buckets; ++i) {
diff --git a/source/kernel/gen_system/Makefile b/source/kernel/gen_system/Makefile
index 855af376615..31535ad2a97 100644
--- a/source/kernel/gen_system/Makefile
+++ b/source/kernel/gen_system/Makefile
@@ -37,4 +37,5 @@ CCFLAGS += $(LEVEL_2_CPP_WARNINGS)
CPPFLAGS += -I$(NAN_MOTO)/include
CPPFLAGS += -I$(NAN_STRING)/include
+CPPFLAGS += -I../../../source/blender/blenloader