MCPcopy Create free account
hub / github.com/GDRETools/gdsdecomp / continuity_tester

Function continuity_tester

bytecode/bytecode_base.cpp:1695–1727  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1693
1694template <typename T>
1695static int64_t continuity_tester(const Vector<T> &p_vector, const Vector<T> &p_other, String name, int pos = 0) {
1696 if (p_vector.is_empty() && p_other.is_empty()) {
1697 return -1;
1698 }
1699 if (p_vector.is_empty() && !p_other.is_empty()) {
1700 // WARN_PRINT(name + " first is empty");
1701 return -1;
1702 }
1703 if (!p_vector.is_empty() && p_other.is_empty()) {
1704 // WARN_PRINT(name + " second is empty");
1705 return -1;
1706 }
1707 if (pos == 0) {
1708 if (p_vector.size() != p_other.size()) {
1709 // WARN_PRINT(name + " size mismatch: " + itos(p_vector.size()) + " != " + itos(p_other.size()));
1710 }
1711 }
1712 if (pos >= p_vector.size() || pos >= p_other.size()) {
1713 // WARN_PRINT(name + " pos out of range");
1714 return MIN(p_vector.size(), p_other.size());
1715 }
1716 for (int i = pos; i < p_vector.size(); i++) {
1717 if (i >= p_other.size()) {
1718 // WARN_PRINT(name + " discontinuity at index " + itos(i));
1719 return i;
1720 }
1721 if (p_vector[i] != p_other[i]) {
1722 // WARN_PRINT(name + " discontinuity at index " + itos(i));
1723 return i;
1724 }
1725 }
1726 return -1;
1727}
1728
1729template <typename K, typename V>
1730static int64_t continuity_tester(const HashMap<K, V> &p_vector, const HashMap<K, V> &p_other, String name, int pos = 0) {

Callers 1

test_bytecode_matchMethod · 0.85

Calls 2

push_backMethod · 0.80
sizeMethod · 0.45

Tested by 1

test_bytecode_matchMethod · 0.68