MCPcopy Create free account
hub / github.com/chen3feng/toft / FormatBinaryMeasure

Function FormatBinaryMeasure

base/string/number.cpp:923–932  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

921}
922
923std::string FormatBinaryMeasure(int64_t n, const char* unit)
924{
925 // see http://zh.wikipedia.org/wiki/%E4%BA%8C%E8%BF%9B%E5%88%B6%E4%B9%98%E6%95%B0%E8%AF%8D%E5%A4%B4
926 static const char* const prefixes[] = {
927 "", "Ki", "Mi", "Gi", "Ti", "Pi", "Ei", "Zi", "Yi"
928 };
929
930 return NumberToHumanReadableString<int64_t, 1024>(
931 n, prefixes, unit, 0, TOFT_ARRAY_SIZE(prefixes) - 1);
932}
933
934} // namespace toft

Callers 1

TESTFunction · 0.85

Calls

no outgoing calls

Tested by 1

TESTFunction · 0.68