Skip to content

Commit

Permalink
Fix bit interleave and deinterleave (#676)
Browse files Browse the repository at this point in the history
# Pull Request

## What problem does this PR solve?

Issue Number: Fixed #675 

## Possible side effects?

- Performance: No

- Backward compatibility: No
  • Loading branch information
tpppppub committed May 8, 2024
1 parent f9f9334 commit 6f05c97
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libspu/mpc/ab_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ Value bitintl_b(SPUContext* ctx, const Value& x, size_t stride) {
const size_t nbits = x.storage_type().as<BShare>()->nbits();
SPU_ENFORCE(absl::has_single_bit(nbits));

Value out;
Value out = x;
for (int64_t idx = Log2Ceil(nbits) - 2; idx >= static_cast<int64_t>(stride);
idx--) {
auto K = hack_make_p(ctx, spu::detail::kBitIntlKeepMasks[idx], x.shape());
Expand Down Expand Up @@ -277,7 +277,7 @@ Value bitdeintl_b(SPUContext* ctx, const Value& x, size_t stride) {
const size_t nbits = x.storage_type().as<BShare>()->nbits();
SPU_ENFORCE(absl::has_single_bit(nbits));

Value out;
Value out = x;
for (int64_t idx = stride; idx + 1 < Log2Ceil(nbits); idx++) {
auto K = hack_make_p(ctx, spu::detail::kBitIntlKeepMasks[idx], x.shape());
auto M = hack_make_p(ctx, spu::detail::kBitIntlSwapMasks[idx], x.shape());
Expand Down

0 comments on commit 6f05c97

Please sign in to comment.