MCPcopy Create free account
hub / github.com/Singular/Singular / uncheckedAdd

Method uncheckedAdd

ppcc/adlib/set.h:197–217  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

195
196template <typename T>
197void Set<T>::uncheckedAdd(T item, bool replace) {
198 INIT_HASH_LOOP(item);
199 Int freepos = -1;
200 while (_state[pos] != SLOT_EMPTY) {
201 if (_state[pos] == occ && _cmp(_data[pos], item) == 0) {
202 if (replace)
203 _data[pos] = item;
204 return;
205 }
206 if (_state[pos] == SLOT_DELETED && freepos < 0)
207 freepos = pos;
208 pos = next(pos, hash) & mask;
209 }
210 if (freepos >= 0) {
211 _deleted--;
212 pos = freepos;
213 }
214 _data[pos] = item;
215 _state[pos] = occ;
216 _count++;
217}
218
219template <typename T>
220T Set<T>::get_or_add(T item) {

Callers

nothing calls this directly

Calls 1

nextFunction · 0.85

Tested by

no test coverage detected