MCPcopy Create free account
hub / github.com/NetSys/bess / FindSlot

Method FindSlot

core/utils/cuckoo_map.h:432–445  ·  view source on GitHub ↗

Return the slot index in the bucket that matches the primary hash_value and the actual key. Return -1 if not found.

Source from the content-addressed store, hash-verified

430 // Return the slot index in the bucket that matches the primary hash_value
431 // and the actual key. Return -1 if not found.
432 int FindSlot(const Bucket& bucket, HashResult primary, const K& key,
433 const E& eq) const {
434 for (int i = 0; i < kEntriesPerBucket; i++) {
435 if (bucket.hash_values[i] == primary) {
436 EntryIndex idx = bucket.entry_indices[i];
437 const Entry& entry = entries_[idx];
438
439 if (likely(Eq(entry.first, key, eq))) {
440 return i;
441 }
442 }
443 }
444 return -1;
445 }
446
447 // Recursively try making an empty slot in the bucket
448 // Returns a slot index in [0, kEntriesPerBucket) for successful operation,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected