MCPcopy Create free account
hub / github.com/defold/defold / dmHashBuffer32

Function dmHashBuffer32

engine/dlib/src/dlib/hash.cpp:229–251  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

227}
228
229uint32_t dmHashBuffer32(const void * key, uint32_t len)
230{
231 uint32_t h = dmHashBufferNoReverse32(key, len);
232
233 if (dmHashContainer().m_Enabled && len <= DMHASH_MAX_REVERSE_LENGTH)
234 {
235 DM_MUTEX_SCOPED_LOCK(dmHashContainer().m_Mutex);
236 dmHashTable32<ReverseHashEntry>* hash_table = &dmHashContainer().m_HashTable32Entries;
237 if (hash_table->Get(h) == 0)
238 {
239 if (hash_table->Full())
240 {
241 IncreaseTableCapacity(hash_table, dmHashContainer().m_HashTableCapacityIncrement);
242 }
243 char* copy = (char*) malloc(len + 1);
244 memcpy(copy, key, len);
245 copy[len] = '\0';
246 hash_table->Put(h, ReverseHashEntry(copy, len));
247 }
248 }
249
250 return h;
251}
252
253// Based on MurmurHash2A but endian neutral
254uint64_t dmHashBufferNoReverse64(const void * key, uint32_t len)

Callers 15

script.cppFile · 0.50
SetGlobalFunction · 0.50
SetUserTypeFunction · 0.50
script_timer.cppFile · 0.50
GetTestScriptExtensionFunction · 0.50
TEST_FFunction · 0.50
dmHashCTestIncrementalFunction · 0.50
TEST_FFunction · 0.50

Calls 7

dmHashBufferNoReverse32Function · 0.85
IncreaseTableCapacityFunction · 0.85
mallocFunction · 0.85
ReverseHashEntryClass · 0.85
GetMethod · 0.45
FullMethod · 0.45
PutMethod · 0.45

Tested by 8

GetTestScriptExtensionFunction · 0.40
TEST_FFunction · 0.40
dmHashCTestIncrementalFunction · 0.40
TEST_FFunction · 0.40
TEST_FFunction · 0.40