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

Method findEntry

include/reactphysics3d/containers/Set.h:86–103  ·  view source on GitHub ↗

Return the index of the entry with a given value or -1 if there is no entry with this value

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected