Skip to content

Commit

Permalink
Fix gadget.h (#265)
Browse files Browse the repository at this point in the history
* Update ea_code.h

* Update ea_code.h

* Update dpf.h

* Update dpf.cc

* Update dpf.cc

* Update gywz_ote.h

* Update ot_store.cc

* Update ferret_ote_un.h

* Update ferret_ote_un.h

* Update ferret_ote_un.h

* Update gadget.h

Log2(1)=0

* Update sgrr_ote_test.cc

* Update gywz_ote_test.cc
  • Loading branch information
maths644311798 authored Feb 22, 2024
1 parent 0141a0d commit 6d42bfa
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion yacl/crypto/primitives/ot/gywz_ote_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ TEST(GywzEdgeTest, Work) {
auto index = RandInRange(n);
auto lctxs = link::test::SetupWorld(2);
uint128_t delta = SecureRandSeed();
auto base_ot = MockCots(math::Log2Ceil(n), delta); // mock many base OTs
auto base_ot = MockCots(1, delta); // mock many base OTs

std::vector<uint128_t> send_out(n);
std::vector<uint128_t> recv_out(n);
Expand Down
2 changes: 1 addition & 1 deletion yacl/crypto/primitives/ot/sgrr_ote_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ TEST(SgrrEdgeTest, Work) {

auto index = RandInRange(n);
auto lctxs = link::test::SetupWorld(2);
auto base_ot = MockRots(math::Log2Ceil(n)); // mock many base OTs
auto base_ot = MockRots(1); // mock many base OTs

std::vector<uint128_t> send_out(n);
std::vector<uint128_t> recv_out(n);
Expand Down
2 changes: 1 addition & 1 deletion yacl/math/gadget.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ inline uint64_t Log2Floor(uint64_t x) {

inline uint64_t Log2Ceil(uint64_t x) {
YACL_ENFORCE(x != 0, "log2(0) is undefined");
return x == 1 ? 1 : Log2Floor(x - 1) + 1;
return x == 1 ? 0 : Log2Floor(x - 1) + 1;
}

constexpr uint64_t DivCeil(uint64_t x, uint64_t y) {
Expand Down

0 comments on commit 6d42bfa

Please sign in to comment.