Browse Source

correcting the handling of argc

avadapal 7 months ago
parent
commit
034c08976b
2 changed files with 5 additions and 8 deletions
  1. 0 1
      duoram.hpp
  2. 5 7
      heap.cpp

+ 0 - 1
duoram.hpp

@@ -548,7 +548,6 @@ public:
    // P0 and P1 output vectors r0 and r1 such that r0 \oplus r1 = [000100] 
    std::vector<RegBS> unit_vector(MPCTIO &tio, yield_t &yield, size_t nitems, RegXS foundidx)
    {
-    
       std::vector<RegBS> standard_basis(nitems); 
       
       if (player < 2) {

+ 5 - 7
heap.cpp

@@ -661,11 +661,12 @@ void Heap(MPCIO & mpcio,  const PRACOptions & opts, char ** args, int argc) {
 
     MPCTIO tio(mpcio, 0, opts.num_threads);
 
-    int nargs = argc;
+    int nargs = 0;
     
-    if(tio.player() == 2) nargs -= 6;
-    if(tio.player() == 1) nargs -= 5;
-    if(tio.player() == 0) nargs -= 4;
+    for (int i = 0; i < argc; i++) {
+        if(args[i]==nullptr) break;
+        ++nargs;
+    }
     
     int maxdepth = 0;
     int heapdepth = 0;
@@ -674,7 +675,6 @@ void Heap(MPCIO & mpcio,  const PRACOptions & opts, char ** args, int argc) {
     int is_optimized = 0;
     int run_sanity = 0;
 
-    // Process command line arguments
     for (int i = 0; i < nargs; i += 2) {
         std::string option = args[i];
         if (option == "-m" && i + 1 < nargs) {
@@ -692,8 +692,6 @@ void Heap(MPCIO & mpcio,  const PRACOptions & opts, char ** args, int argc) {
         }
     }
  
-    
-    
     run_coroutines(tio, [ & tio, maxdepth, heapdepth, n_inserts, n_extracts, is_optimized, run_sanity, &mpcio](yield_t & yield) {
         size_t size = size_t(1) << maxdepth;
         MinHeap tree(tio.player(), size);