Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions shell_encryption/rns/rns_polynomial_hwy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,11 @@ void BatchFusedMulAddMontgomeryRepHwy(absl::Span<const ModularInt64> a,

// Generate the masks on the even lanes, which correspond to the lower 64 bits
// of BigInt64 (unsigned 128-bit int) values in the output vector.
uint8_t* mask_lo_bits = new uint8_t[(N + 7) / 8];
for (int j = 0; j < (N + 7) / 8; ++j) {
mask_lo_bits[j] = 0;
// LoadMaskBits requires at least 8 readable bytes, even if N is small.
int num_bytes = (N + 7) / 8;
int alloc_bytes = num_bytes < 8 ? 8 : num_bytes;
uint8_t* mask_lo_bits = new uint8_t[alloc_bytes]();
for (int j = 0; j < num_bytes; ++j) {
for (int k = 0; k < 8; k += 2) {
mask_lo_bits[j] |= static_cast<uint8_t>(1 << k);
}
Expand Down