浏览代码

Only print precomputed value stats if they're more than 0

Ian Goldberg 2 年之前
父节点
当前提交
3999846d2c
共有 1 个文件被更改,包括 14 次插入6 次删除
  1. 14 6
      mpcio.cpp

+ 14 - 6
mpcio.cpp

@@ -312,20 +312,28 @@ MPCPeerIO::MPCPeerIO(unsigned player, ProcessingMode mode,
 void MPCPeerIO::dump_precomp_stats(std::ostream &os)
 void MPCPeerIO::dump_precomp_stats(std::ostream &os)
 {
 {
     for (size_t i=0; i<triples.size(); ++i) {
     for (size_t i=0; i<triples.size(); ++i) {
+        size_t cnt;
         if (i > 0) {
         if (i > 0) {
             os << " ";
             os << " ";
         }
         }
-        os << "T" << i << " t:" << triples[i].get_stats() <<
-            " h:" << halftriples[i].get_stats();
+        os << "T" << i;
+        cnt = triples[i].get_stats();
+        if (cnt > 0) {
+            os << " t:" << cnt;
+        }
+        cnt = halftriples[i].get_stats();
+        if (cnt > 0) {
+            os << " h:" << cnt;
+        }
         for (nbits_t depth=1; depth<=ADDRESS_MAX_BITS; ++depth) {
         for (nbits_t depth=1; depth<=ADDRESS_MAX_BITS; ++depth) {
-            size_t cnt = rdpftriples[i][depth-1].get_stats();
+            cnt = rdpftriples[i][depth-1].get_stats();
             if (cnt > 0) {
             if (cnt > 0) {
                 os << " r" << int(depth) << ":" << cnt;
                 os << " r" << int(depth) << ":" << cnt;
             }
             }
         }
         }
-        size_t ccnt = cdpfs[i].get_stats();
-        if (ccnt > 0) {
-            os << " c:" << ccnt;
+        cnt = cdpfs[i].get_stats();
+        if (cnt > 0) {
+            os << " c:" << cnt;
         }
         }
     }
     }
     os << "\n";
     os << "\n";