Browse Source

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

Ian Goldberg 5 months ago
parent
commit
650561d158
1 changed files with 3 additions and 1 deletions
  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);