diff --git a/cxxmph/cmph_hash_map_test.cc b/cxxmph/cmph_hash_map_test.cc index a75e0cd..f610f15 100644 --- a/cxxmph/cmph_hash_map_test.cc +++ b/cxxmph/cmph_hash_map_test.cc @@ -11,7 +11,7 @@ using cxxmph::cmph_hash_map; int main(int argc, char** argv) { cmph_hash_map b; - for (int i = 0; i < 2*500; ++i) { + for (int i = 0; i < 257; ++i) { b.insert(make_pair(i, i)); } /* diff --git a/cxxmph/mphtable.cc b/cxxmph/mphtable.cc index 669df06..ac898c1 100644 --- a/cxxmph/mphtable.cc +++ b/cxxmph/mphtable.cc @@ -95,13 +95,13 @@ bool MPHTable::GenerateQueue( void MPHTable::Assigning( const vector& edges, const vector& queue) { - cmph_uint32 nedges = m_; cmph_uint32 current_edge = 0; - vector marked_vertices(nedges + 1); + vector marked_vertices(n_ + 1); // Initialize vector of half nibbles with all bits set. cmph_uint32 sizeg = static_cast(ceil(n_/4.0)); vector(sizeg, std::numeric_limits::max()).swap(g_); + cmph_uint32 nedges = m_; // for legibility for (int i = nedges - 1; i + 1 >= 1; --i) { current_edge = queue[i]; cerr << "Current edge " << current_edge << " at queue pos " << i << endl; @@ -117,6 +117,7 @@ void MPHTable::Assigning( } if (!marked_vertices[e[2]]) { set_2bit_value(&g_, e[2], kUnassigned); + assert(marked_vertices.size() > e[2]); marked_vertices[e[2]] = true; } set_2bit_value(&g_, e[0], (6 - (get_2bit_value(g_, e[1]) + get_2bit_value(g_, e[2]))) % 3);