Unverified Commit 58e6c84f authored by refnum's avatar refnum Committed by GitHub

Fix simple -Wsign-conversion cases. (#1571)

* Fix -Wsign-conversion in bigint::subtract_aligned.

n is assigned a size_t, and only used for comparisons with j.

j is assigned 0, compared to n (size_t), and passed to basic_memory_buffer::operator[] (size_t).

* Fix -Wsign-conversion in bigint::assign.

num_bigits is initialised to 0, is only ever incremented, and is passed to basic_memory_buffer::operator[] (size_t) and basic_memory_buffer::resize (size_t).
parent 75a4525e
...@@ -526,7 +526,7 @@ class bigint { ...@@ -526,7 +526,7 @@ class bigint {
FMT_ASSERT(compare(*this, other) >= 0, ""); FMT_ASSERT(compare(*this, other) >= 0, "");
bigit borrow = 0; bigit borrow = 0;
int i = other.exp_ - exp_; int i = other.exp_ - exp_;
for (int j = 0, n = static_cast<int>(other.bigits_.size()); j != n; for (size_t j = 0, n = other.bigits_.size(); j != n;
++i, ++j) { ++i, ++j) {
subtract_bigits(i, other.bigits_[j], borrow); subtract_bigits(i, other.bigits_[j], borrow);
} }
...@@ -578,7 +578,7 @@ class bigint { ...@@ -578,7 +578,7 @@ class bigint {
} }
void assign(uint64_t n) { void assign(uint64_t n) {
int num_bigits = 0; size_t num_bigits = 0;
do { do {
bigits_[num_bigits++] = n & ~bigit(0); bigits_[num_bigits++] = n & ~bigit(0);
n >>= bigit_bits; n >>= bigit_bits;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment