This commit is contained in:
Mars 2024-06-09 20:14:51 -04:00
parent 94d08a02d6
commit 4d1e69bbe5
Signed by: pupbrained
GPG key ID: 874E22DF2F9DFCB5
8 changed files with 167 additions and 133 deletions

View file

@ -11,13 +11,14 @@ struct BytesToGiB {
u64 value;
};
constexpr u64 GIB = 1'073'741'824;
template <>
struct fmt::formatter<BytesToGiB> : formatter<double> {
template <typename FmtCtx>
fn format(const BytesToGiB BTG, FmtCtx& ctx) -> typename FmtCtx::iterator {
typename FmtCtx::iterator out = formatter<double>::format(
static_cast<double>(BTG.value) / pow(1024, 3), ctx
);
typename FmtCtx::iterator out =
formatter<double>::format(static_cast<double>(BTG.value) / GIB, ctx);
*out++ = 'G';
*out++ = 'i';
*out++ = 'B';