X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;ds=sidebyside;f=binmerger.cpp;h=9bd969ead0d3795ed0a495047ad5e2ae77232a0c;hb=f7f8ba0f6969452da0b1d4bc6f4c8490006f7dbe;hp=6c162404e416e1c347ee449d83ee82153297ebfb;hpb=19c49abb677f8cbf5b290e71dbcad382558d8cc5;p=remoteglot-book diff --git a/binmerger.cpp b/binmerger.cpp index 6c16240..9bd969e 100644 --- a/binmerger.cpp +++ b/binmerger.cpp @@ -2,6 +2,7 @@ #include #include #include +#include #include #include #include "count.pb.h" @@ -38,6 +39,18 @@ void merge_count(void* userdata, } } + // Merge the moves, with deduplication. + unordered_set moves; + for (int i = 0; i < c0.move_size(); ++i) { + moves.insert(c0.move(i)); + c.add_move(c0.move(i)); + } + for (int i = 0; i < c1.move_size(); ++i) { + if (!moves.count(c1.move(i))) { + c.add_move(c1.move(i)); + } + } + static string buf; // Keep allocated. c.SerializeToString(&buf);