Skip to content

Commit 9e02538

Browse files
committed
Fix some warnings on Windows
1 parent 98653b2 commit 9e02538

File tree

7 files changed

+7
-7
lines changed

7 files changed

+7
-7
lines changed

libff/algebra/curves/curve_utils.tcc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ GroupT scalar_mul(const GroupT &base, const bigint<m> &scalar)
1616
GroupT result = GroupT::zero();
1717

1818
bool found_one = false;
19-
for (long i = scalar.max_bits() - 1; i >= 0; --i)
19+
for (long i = static_cast<long>(scalar.max_bits() - 1); i >= 0; --i)
2020
{
2121
if (found_one)
2222
{

libff/algebra/fields/bigint.tcc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ bool bigint<n>::test_bit(const std::size_t bitno) const
158158
const std::size_t part = bitno/GMP_NUMB_BITS;
159159
const std::size_t bit = bitno - (GMP_NUMB_BITS*part);
160160
const mp_limb_t one = 1;
161-
return (this->data[part] & (one<<bit));
161+
return (this->data[part] & (one<<bit)) != 0;
162162
}
163163
}
164164

libff/algebra/fields/field_utils.tcc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ void batch_invert(std::vector<FieldT> &vec)
189189

190190
FieldT acc_inverse = acc.inverse();
191191

192-
for (long i = vec.size()-1; i >= 0; --i)
192+
for (long i = static_cast<long>(vec.size()-1); i >= 0; --i)
193193
{
194194
const FieldT old_el = vec[i];
195195
vec[i] = acc_inverse * prod[i];

libff/algebra/fields/fp.tcc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ Fp_model<n,modulus>::Fp_model(const bigint<n> &b)
196196
template<mp_size_t n, const bigint<n>& modulus>
197197
Fp_model<n,modulus>::Fp_model(const long x, const bool is_unsigned)
198198
{
199-
static_assert(std::numeric_limits<mp_limb_t>::max() >= std::numeric_limits<long>::max(), "long won't fit in mp_limb_t");
199+
static_assert(std::numeric_limits<mp_limb_t>::max() >= static_cast<unsigned long>(std::numeric_limits<long>::max()), "long won't fit in mp_limb_t");
200200
if (is_unsigned || x >= 0)
201201
{
202202
this->mont_repr.data[0] = (mp_limb_t)x;

libff/algebra/fields/fp4.tcc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ Fp4_model<n, modulus> Fp4_model<n,modulus>::cyclotomic_exp(const bigint<m> &expo
189189
bool found_nonzero = false;
190190
std::vector<long> NAF = find_wnaf(1, exponent);
191191

192-
for (long i = NAF.size() - 1; i >= 0; --i)
192+
for (long i = static_cast<long>(NAF.size() - 1); i >= 0; --i)
193193
{
194194
if (found_nonzero)
195195
{

libff/algebra/fields/fp6_2over3.tcc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ Fp6_2over3_model<n, modulus> Fp6_2over3_model<n,modulus>::cyclotomic_exp(const b
219219
bool found_nonzero = false;
220220
std::vector<long> NAF = find_wnaf(1, exponent);
221221

222-
for (long i = NAF.size() - 1; i >= 0; --i)
222+
for (long i = static_cast<long>(NAF.size() - 1); i >= 0; --i)
223223
{
224224
if (found_nonzero)
225225
{

libff/common/utils.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ size_t get_power_of_two(size_t n);
2525
/// returns ceil(log2(n)), so 1ul<<log2(n) is the smallest power of 2, that is not less than n
2626
size_t log2(size_t n);
2727

28-
inline size_t exp2(size_t k) { return 1ul << k; }
28+
inline size_t exp2(size_t k) { return size_t(1) << k; }
2929

3030
size_t to_twos_complement(int i, size_t w);
3131
int from_twos_complement(size_t i, size_t w);

0 commit comments

Comments
 (0)