Minor cleanup

This commit is contained in:
Victor Zverovich 2019-02-13 06:14:22 -08:00
parent 9660ea1bff
commit 83808076e3
2 changed files with 4 additions and 13 deletions

View File

@ -1388,13 +1388,8 @@ typename buffer_context<Char>::type::iterator vformat_to(
fmt::print("Elapsed time: {s:.2f} seconds", fmt::arg("s", 1.23));
\endrst
*/
template <typename T>
inline internal::named_arg<T, char> arg(string_view name, const T& arg) {
return {name, arg};
}
template <typename T>
inline internal::named_arg<T, wchar_t> arg(wstring_view name, const T& arg) {
template <typename S, typename T>
inline internal::named_arg<T, FMT_CHAR(S)> arg(const S& name, const T& arg) {
return {name, arg};
}

View File

@ -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
// with half-up tie breaking, r.e = x.e + y.e + 64. Result may not be
// 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) {
// Multiply 32-bit parts of significands.
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);
}
// 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) {
const double one_over_log2_10 = 0.30102999566398114; // 1 / log2(10)
int index = static_cast<int>(