MCPcopy Create free account
hub / github.com/DanielChappuis/reactphysics3d / findEntry

Method findEntry

include/reactphysics3d/containers/Map.h:87–104  ·  view source on GitHub ↗

Return the index of the entry with a given key or INVALID_INDEX if there is no entry with this key

Source from the content-addressed store, hash-verified

85
86 /// Return the index of the entry with a given key or INVALID_INDEX if there is no entry with this key
87 uint64 findEntry(const K& key) const {
88
89 if (mHashSize > 0) {
90
91 const size_t hashCode = Hash()(key);
92 const size_t divider = mHashSize - 1;
93 const uint64 bucket = static_cast<uint64>(hashCode & divider);
94 auto keyEqual = KeyEqual();
95
96 for (uint64 i = mBuckets[bucket]; i != INVALID_INDEX; i = mNextEntries[i]) {
97 if (Hash()(mEntries[i].first) == hashCode && keyEqual(mEntries[i].first, key)) {
98 return i;
99 }
100 }
101 }
102
103 return INVALID_INDEX;
104 }
105
106 public:
107

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected