Removed redundant format_decimal implementation for constexpr context
This commit is contained in:
parent
3f5e3cbb2c
commit
768caf7c9a
@ -1090,19 +1090,11 @@ template <typename Iterator> struct format_decimal_result {
|
|||||||
// buffer of specified size. The caller must ensure that the buffer is large
|
// buffer of specified size. The caller must ensure that the buffer is large
|
||||||
// enough.
|
// enough.
|
||||||
template <typename Char, typename UInt>
|
template <typename Char, typename UInt>
|
||||||
FMT_CONSTEXPR20 auto format_decimal(Char* out, UInt value, int size)
|
FMT_CONSTEXPR auto format_decimal(Char* out, UInt value, int size)
|
||||||
-> format_decimal_result<Char*> {
|
-> format_decimal_result<Char*> {
|
||||||
FMT_ASSERT(size >= count_digits(value), "invalid digit count");
|
FMT_ASSERT(size >= count_digits(value), "invalid digit count");
|
||||||
out += size;
|
out += size;
|
||||||
Char* end = out;
|
Char* end = out;
|
||||||
if (is_constant_evaluated()) {
|
|
||||||
while (value >= 10) {
|
|
||||||
*--out = static_cast<Char>('0' + value % 10);
|
|
||||||
value /= 10;
|
|
||||||
}
|
|
||||||
*--out = static_cast<Char>('0' + value);
|
|
||||||
return {out, end};
|
|
||||||
}
|
|
||||||
while (value >= 100) {
|
while (value >= 100) {
|
||||||
// Integer division is slow so do it for a group of two digits instead
|
// Integer division is slow so do it for a group of two digits instead
|
||||||
// of for every digit. The idea comes from the talk by Alexandrescu
|
// of for every digit. The idea comes from the talk by Alexandrescu
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user