Skip to content

Commit

Permalink
Merge pull request NilFoundation#51 from NilFoundation/50-fix-a-few-w…
Browse files Browse the repository at this point in the history
…arnings-that-can-be-interpreted-as-errors-on-mac

Fixing warnings in mac.
  • Loading branch information
martun authored Oct 5, 2023
2 parents c08dab2 + ccd0dff commit e8e2d88
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion include/nil/crypto3/multiprecision/modular/inverse.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ namespace nil {
constexpr Backend eval_inverse_mod_odd(const Backend& n, const Backend& mod)
{
using ui_type = typename std::tuple_element<0, typename Backend::unsigned_types>::type;
Backend zero, one, two;
Backend zero, one;
zero = ui_type(0u);
one = ui_type(1u);
// Caller should assure these preconditions:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ namespace nil {
constexpr modular_params<Backend> const modular_params_ct<Backend, Modulus>::m_mod;

template<typename Backend, typename StorageType>
struct modular_adaptor {
class modular_adaptor {
public:
typedef modular_params<Backend> modular_type;
typedef Backend backend_type;

Expand Down Expand Up @@ -405,7 +406,7 @@ namespace nil {
window_bits += wsize[j][1];

return window_bits;
};
}

template<class Backend, typename StorageType>
inline void find_modular_pow(modular_adaptor<Backend, StorageType> &result,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ namespace nil {
Backend_doubled_padded_limbs accum(result);
Backend_doubled_padded_limbs prod;

for (auto i = 0; i < m_mod.backend().size(); ++i) {
for (size_t i = 0; i < m_mod.backend().size(); ++i) {
eval_multiply(prod, m_mod.backend(),
static_cast<double_limb_type>(static_cast<internal_limb_type>(
custom_get_limb_value<internal_limb_type>(accum, i) *
Expand Down Expand Up @@ -479,11 +479,11 @@ namespace nil {
// BOOST_ASSERT(eval_lt(x, m_mod.backend()) && eval_lt(y, m_mod.backend()));

Backend_padded_limbs A(internal_limb_type(0u));
const auto mod_size = m_mod.backend().size();
const size_t mod_size = m_mod.backend().size();
auto mod_last_limb = static_cast<internal_double_limb_type>(get_limb_value(m_mod.backend(), 0));
auto y_last_limb = get_limb_value(y, 0);

for (auto i = 0; i < mod_size; i++) {
for (size_t i = 0; i < mod_size; i++) {
auto x_i = get_limb_value(result, i);
auto A_0 = A.limbs()[0];
internal_limb_type u_i = (A_0 + x_i * y_last_limb) * m_montgomery_p_dash;
Expand All @@ -500,7 +500,7 @@ namespace nil {
k = static_cast<internal_limb_type>(z >> std::numeric_limits<internal_limb_type>::digits);
k2 = static_cast<internal_limb_type>(z2 >> std::numeric_limits<internal_limb_type>::digits);

for (auto j = 1; j < mod_size; ++j) {
for (size_t j = 1; j < mod_size; ++j) {
internal_double_limb_type t =
static_cast<internal_double_limb_type>(get_limb_value(y, j)) *
static_cast<internal_double_limb_type>(x_i) +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ namespace nil {
}

template<typename Backend>
class modular_policy;
struct modular_policy;

template<unsigned MinBits, cpp_integer_type SignType, cpp_int_check_type Checked>
struct modular_policy<modular_fixed_cpp_int_backend<MinBits, SignType, Checked>> {
Expand Down

0 comments on commit e8e2d88

Please sign in to comment.