mirror of
https://github.com/fmtlib/fmt.git
synced 2025-07-30 10:47:35 +02:00
Minor cleanup
This commit is contained in:
@ -1388,13 +1388,8 @@ typename buffer_context<Char>::type::iterator vformat_to(
|
|||||||
fmt::print("Elapsed time: {s:.2f} seconds", fmt::arg("s", 1.23));
|
fmt::print("Elapsed time: {s:.2f} seconds", fmt::arg("s", 1.23));
|
||||||
\endrst
|
\endrst
|
||||||
*/
|
*/
|
||||||
template <typename T>
|
template <typename S, typename T>
|
||||||
inline internal::named_arg<T, char> arg(string_view name, const T& arg) {
|
inline internal::named_arg<T, FMT_CHAR(S)> arg(const S& name, const T& arg) {
|
||||||
return {name, arg};
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
inline internal::named_arg<T, wchar_t> arg(wstring_view name, const T& arg) {
|
|
||||||
return {name, arg};
|
return {name, arg};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -419,12 +419,6 @@ inline fp operator-(fp x, fp y) {
|
|||||||
// Computes an fp number r with r.f = x.f * y.f / pow(2, 64) rounded to nearest
|
// Computes an fp number r with r.f = x.f * y.f / pow(2, 64) rounded to nearest
|
||||||
// with half-up tie breaking, r.e = x.e + y.e + 64. Result may not be
|
// with half-up tie breaking, r.e = x.e + y.e + 64. Result may not be
|
||||||
// normalized.
|
// normalized.
|
||||||
FMT_API fp operator*(fp x, fp y);
|
|
||||||
|
|
||||||
// Returns cached power (of 10) c_k = c_k.f * pow(2, c_k.e) such that its
|
|
||||||
// (binary) exponent satisfies min_exponent <= c_k.e <= min_exponent + 3.
|
|
||||||
FMT_API fp get_cached_power(int min_exponent, int& pow10_exponent);
|
|
||||||
|
|
||||||
FMT_FUNC fp operator*(fp x, fp y) {
|
FMT_FUNC fp operator*(fp x, fp y) {
|
||||||
// Multiply 32-bit parts of significands.
|
// Multiply 32-bit parts of significands.
|
||||||
uint64_t mask = (1ULL << 32) - 1;
|
uint64_t mask = (1ULL << 32) - 1;
|
||||||
@ -436,6 +430,8 @@ FMT_FUNC fp operator*(fp x, fp y) {
|
|||||||
return fp(ac + (ad >> 32) + (bc >> 32) + (mid >> 32), x.e + y.e + 64);
|
return fp(ac + (ad >> 32) + (bc >> 32) + (mid >> 32), x.e + y.e + 64);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Returns cached power (of 10) c_k = c_k.f * pow(2, c_k.e) such that its
|
||||||
|
// (binary) exponent satisfies min_exponent <= c_k.e <= min_exponent + 28.
|
||||||
FMT_FUNC fp get_cached_power(int min_exponent, int& pow10_exponent) {
|
FMT_FUNC fp get_cached_power(int min_exponent, int& pow10_exponent) {
|
||||||
const double one_over_log2_10 = 0.30102999566398114; // 1 / log2(10)
|
const double one_over_log2_10 = 0.30102999566398114; // 1 / log2(10)
|
||||||
int index = static_cast<int>(
|
int index = static_cast<int>(
|
||||||
|
Reference in New Issue
Block a user