Parcourir la source

binary_search sometimes returned -1 instead of 1 when searching over a single item

Ian Goldberg il y a 6 mois
Parent
commit
650561d158
1 fichiers modifiés avec 3 ajouts et 1 suppressions
  1. 3 1
      duoram.cpp

+ 3 - 1
duoram.cpp

@@ -104,7 +104,9 @@ RegXS Duoram<RegAS>::Shape::binary_search(RegAS &target)
         // answer is here or to the left, so it must be 0.  If val <
         // target, the answer is strictly to the right, so it must be 1.
         // So just return lt.
-        return RegXS(lt);
+        RegXS ret;
+        ret.xshare = lt.bshare;
+        return ret;
     }
     auto oidx = P.oblivindex(depth-1);
     oidx.incr(lt);