MCPcopy Create free account
hub / github.com/beefytech/Beef / TryInsert

Method TryInsert

IDEHelper/Linker/BlCodeView.cpp:32–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30}
31
32int BlCvRecordMap::TryInsert(const char* name, const Val128& key)
33{
34 auto pair = mKeySet.insert(key);
35 if (!pair.second)
36 return -1;
37
38 //BL_AUTOPERF_CV("BlCvRecordMap::TryInsert insert");
39
40 int hashKey = BlHash::HashStr_PdbV1(name) % 4096;
41 /*auto checkEntry = mBuckets[hashKey];
42 while (checkEntry != NULL)
43 {
44 if (checkEntry->mKey == key)
45 return -1;
46 checkEntry = checkEntry->mNext;
47 }*/
48
49 auto entry = mAlloc.Alloc<BlCvRecordEntry>();
50 entry->mKey = key;
51 entry->mNext = mBuckets[hashKey];
52 mBuckets[hashKey] = entry;
53 mNumEntries++;
54 entry->mRecordIndex = mCodeView->mSymRecordsWriter.GetStreamPos();
55 return entry->mRecordIndex;
56}
57
58
59//////////////////////////////////////////////////////////////////////////

Callers 1

Calls 1

GetStreamPosMethod · 0.45

Tested by

no test coverage detected