mirror of
https://github.com/fmtlib/fmt.git
synced 2025-09-08 12:02:51 -04:00
Remove the sizeof(T) from fill_n taking char and replace with a static assert. Use a 0U to initialize bigits_.data()
This commit is contained in:
parent
90a59f5d59
commit
d17402267e
@ -553,7 +553,8 @@ 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);
|
||||
std::memset(out, value, to_unsigned(count) * sizeof(T));
|
||||
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;
|
||||
}
|
||||
|
||||
@ -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];
|
||||
fill_n(bigits_.data(), to_unsigned(exp_difference), 0);
|
||||
fill_n(bigits_.data(), to_unsigned(exp_difference), 0U);
|
||||
exp_ -= exp_difference;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user