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

Function Insert

IDEHelper/StrHashMap.h:116–132  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

114 }
115
116 void Insert(T value)
117 {
118 if (mHashHeads == NULL)
119 mHashHeads = (Entry**)mAlloc.AllocBytes(sizeof(Entry*) * mHashSize, alignof(Entry*));
120
121 int hash = GetHash(value->mName);
122 int hashIdx = hash % mHashSize;
123 Entry* headEntry = mHashHeads[hashIdx];
124
125 Entry* newEntry = mAlloc.Alloc<Entry>();
126 newEntry->mValue = value;
127 newEntry->mNext = headEntry;
128 newEntry->mHash = hash;
129 mCount++;
130
131 mHashHeads[hashIdx] = newEntry;
132 }
133
134 void Rehash(int newHashSize)
135 {

Callers 6

AddMethod · 0.85
TryAddMethod · 0.85
DictionaryClass · 0.85
ForceAddMethod · 0.85
TryAddMethod · 0.85
TryAddRawMethod · 0.85

Calls 1

AllocBytesMethod · 0.45

Tested by

no test coverage detected