Skip to content
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion include/fmt/format.h
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,7 @@ FMT_CONSTEXPR auto fill_n(OutputIt out, Size count, const T& value)
template <typename T, typename Size>
FMT_CONSTEXPR20 auto fill_n(T* out, Size count, char value) -> T* {
if (is_constant_evaluated()) return fill_n<T*, Size, T>(out, count, value);
static_assert(1 == sizeof(T), "sizeof(T) must be 1 to use char for initialization");
std::memset(out, value, to_unsigned(count));
return out + count;
}
Expand Down Expand Up @@ -2799,7 +2800,7 @@ class bigint {
bigits_.resize(to_unsigned(num_bigits + exp_difference));
for (int i = num_bigits - 1, j = i + exp_difference; i >= 0; --i, --j)
bigits_[j] = bigits_[i];
memset(bigits_.data(), 0, to_unsigned(exp_difference) * sizeof(bigit));
fill_n(bigits_.data(), to_unsigned(exp_difference), 0U);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why U?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bigit is a uint32_t so bigits_.data() returns a uint32_t*. 0U is the unsigned literal for 0. I could use fill_n(bigits_.data(), to_unsigned(exp_difference), to_unsigned(0)); if that's better but thought using the literal U would convey the same meaning. LMK if you prefer I change it to something else. The 0 is by default signed so I got a signed/unsigned warning.

exp_ -= exp_difference;
}

Expand Down
Loading