Explorar el Código

u[0] was never getting initialized in insert_optimized

Ian Goldberg hace 2 años
padre
commit
7ed6c13978
Se han modificado 1 ficheros con 5 adiciones y 1 borrados
  1. 5 1
      heap.cpp

+ 5 - 1
heap.cpp

@@ -99,7 +99,11 @@ void MinHeap::insert_optimized(MPCTIO tio, yield_t & yield, RegAS val) {
 
     for (size_t j = 0; j < height; ++j) {
         if(tio.player() !=2) {
-            if(j > 0) u[j] = flag[j] ^ u[j-1];
+            if(j > 0) {
+                u[j] = flag[j] ^ u[j-1];
+            } else {
+                u[j] = flag[j];
+            }
         }
     }