MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / recursive_equal

Method recursive_equal

core/variant/array.cpp:141–166  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

139}
140
141bool Array::recursive_equal(const Array &p_array, int recursion_count) const {
142 // Cheap checks
143 if (_p == p_array._p) {
144 return true;
145 }
146 const Vector<Variant> &a1 = _p->array;
147 const Vector<Variant> &a2 = p_array._p->array;
148 const int size = a1.size();
149 if (size != a2.size()) {
150 return false;
151 }
152
153 // Heavy O(n) check
154 if (recursion_count > MAX_RECURSION) {
155 ERR_PRINT("Max recursion reached");
156 return true;
157 }
158 recursion_count++;
159 for (int i = 0; i < size; i++) {
160 if (!a1[i].hash_compare(a2[i], recursion_count, false)) {
161 return false;
162 }
163 }
164
165 return true;
166}
167
168bool Array::operator<(const Array &p_array) const {
169 int a_len = size();

Calls 2

hash_compareMethod · 0.80
sizeMethod · 0.65

Tested by

no test coverage detected