diff --git a/montgomery.cc b/montgomery.cc index d5221f4..9fbc5da 100644 --- a/montgomery.cc +++ b/montgomery.cc @@ -22,8 +22,8 @@ template rlwe::StatusOr>> MontgomeryIntParams::Create(Int modulus) { // Check that the modulus is smaller than max(Int) / 4. - if (Int most_significant_bit = modulus >> (bitsize_int - 2); - most_significant_bit != 0) { + Int most_significant_bit = modulus >> (bitsize_int - 2); + if (most_significant_bit != 0) { return absl::InvalidArgumentError(absl::StrCat( "The modulus should be less than 2^", (bitsize_int - 2), ".")); } diff --git a/ntt_parameters.h b/ntt_parameters.h index 56e1871..c3da197 100644 --- a/ntt_parameters.h +++ b/ntt_parameters.h @@ -103,7 +103,8 @@ static void BitrevHelper(const std::vector& bitrevs, using std::swap; for (int i = 0; i < item_to_reverse->size(); i++) { // Only swap in one direction - don't accidentally swap twice. - if (unsigned int r = bitrevs[i]; i < r) { + unsigned int r = bitrevs[i]; + if (static_cast(i) < r) { swap((*item_to_reverse)[i], (*item_to_reverse)[r]); } } diff --git a/polynomial.h b/polynomial.h index 07843b2..3cf0c77 100644 --- a/polynomial.h +++ b/polynomial.h @@ -80,7 +80,8 @@ class Polynomial { const NttParameters* ntt_params, const ModularIntParams* modular_params) { // Check to ensure that the coefficient vector is of the correct length. - if (int len = poly_coeffs.size(); len <= 0 || (len & (len - 1)) != 0) { + int len = poly_coeffs.size(); + if (len <= 0 || (len & (len - 1)) != 0) { // An error value. return Polynomial(); } diff --git a/prng/chacha_prng_util.cc b/prng/chacha_prng_util.cc index dfab1d9..c49c82d 100644 --- a/prng/chacha_prng_util.cc +++ b/prng/chacha_prng_util.cc @@ -24,7 +24,8 @@ #include #include "status_macros.h" -namespace rlwe::internal { +namespace rlwe { +namespace internal { absl::Status ChaChaPrngResalt(absl::string_view key, int buffer_size, int* salt_counter, int* position_in_buffer, @@ -85,4 +86,5 @@ rlwe::StatusOr ChaChaPrngRand64(absl::string_view key, return rand64; } -} // namespace rlwe::internal +} // namespace internal +} // namespace rlwe diff --git a/prng/chacha_prng_util.h b/prng/chacha_prng_util.h index 32cac5b..8eb8118 100644 --- a/prng/chacha_prng_util.h +++ b/prng/chacha_prng_util.h @@ -28,7 +28,8 @@ #include "integral_types.h" #include "statusor.h" -namespace rlwe::internal { +namespace rlwe { +namespace internal { const int kChaChaKeyBytesSize = 32; const int kChaChaNonceSize = 12; @@ -59,6 +60,7 @@ rlwe::StatusOr ChaChaPrngRand64(absl::string_view key, int* salt_counter, std::vector* buffer); -} // namespace rlwe::internal +} // namespace internal +} // namespace rlwe #endif // RLWE_CHACHA_PRNG_UTIL_H_ diff --git a/statusor.h b/statusor.h index d8addb5..200f62d 100644 --- a/statusor.h +++ b/statusor.h @@ -96,7 +96,7 @@ class StatusOr { operator absl::Status() const { return status(); } - template