Skip to content

Commit

Permalink
Fix msvc warning
Browse files Browse the repository at this point in the history
  • Loading branch information
FAlbertDev committed Jan 11, 2024
1 parent 3118890 commit 83b2249
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/lib/pubkey/classic_mceliece/cmce_field_ordering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ Classic_McEliece_Field_Ordering Classic_McEliece_Field_Ordering::create_from_con
std::iota(pi.begin(), pi.end(), 0);
for(size_t i = 0; i < 2 * params.m() - 1; ++i) {
size_t gap = size_t(1) << std::min(i, 2 * params.m() - 2 - i);
for(size_t j = 0; j < n / 2; ++j) {
for(size_t j = 0; j < size_t(n / 2); ++j) {
size_t pos = (j % gap) + 2 * gap * (j / gap);
auto mask = CT::Mask<uint16_t>::expand(control_bits[i * n / 2 + j]);
mask.conditional_swap(pi[pos], pi[pos + gap]);
Expand All @@ -297,12 +297,12 @@ void Classic_McEliece_Field_Ordering::permute_with_pivots(const Classic_McEliece
const secure_bitvector& pivots) {
auto col_offset = params.pk_no_rows() - Classic_McEliece_Parameters::mu();

for(uint64_t p_idx = 1; p_idx <= Classic_McEliece_Parameters::mu(); ++p_idx) {
uint64_t p_counter = 0;
for(uint64_t col = 0; col < Classic_McEliece_Parameters::nu(); ++col) {
auto mask_is_pivot_set = CT::Mask<uint64_t>::expand(pivots.at(col));
p_counter += CT::Mask<uint64_t>::expand(pivots.at(col)).if_set_return(1);
auto mask_is_current_pivot = CT::Mask<uint64_t>::is_equal(p_idx, p_counter);
for(size_t p_idx = 1; p_idx <= Classic_McEliece_Parameters::mu(); ++p_idx) {
size_t p_counter = 0;
for(size_t col = 0; col < Classic_McEliece_Parameters::nu(); ++col) {
auto mask_is_pivot_set = CT::Mask<size_t>::expand(pivots.at(col));
p_counter += CT::Mask<size_t>::expand(pivots.at(col)).if_set_return(1);
auto mask_is_current_pivot = CT::Mask<size_t>::is_equal(p_idx, p_counter);
(mask_is_pivot_set & mask_is_current_pivot)
.conditional_swap(m_pi.at(col_offset + col), m_pi.at(col_offset + p_idx - 1));
}
Expand Down

0 comments on commit 83b2249

Please sign in to comment.