MCPcopy Create free account
hub / github.com/HO-COOH/FastCopy / ConvertUnit

Function ConvertUnit

FastCopy/NumberToStringConverter.cpp:18–29  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16 constexpr static auto GB = L" GB";
17
18 static auto ConvertUnit(uint64_t value)
19 {
20 auto const valueDouble = static_cast<double>(value);
21 if (valueDouble / static_cast<double>(ToKB) < 1.0)
22 return std::make_pair(valueDouble, B);
23 else if (valueDouble / static_cast<double>(ToMB) < 1.0)
24 return std::make_pair(valueDouble / static_cast<double>(ToKB), KB);
25 else if (valueDouble / static_cast<double>(ToGB) < 1.0)
26 return std::make_pair(valueDouble / static_cast<double>(ToMB), MB);
27 else
28 return std::make_pair(valueDouble / static_cast<double>(ToGB), GB);
29 }
30
31 winrt::Windows::Foundation::IInspectable NumberToStringConverter::Convert(
32 winrt::Windows::Foundation::IInspectable const& value,

Callers 1

ConvertMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected