MCPcopy Create free account
hub / github.com/baidu/tera / FormatBinaryMeasure

Function FormatBinaryMeasure

src/common/base/string_number.cc:812–818  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

810}
811
812std::string FormatBinaryMeasure(int64_t n, const char* unit) {
813 // see
814 // 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
815 static const char* const prefixes[] = {"", "Ki", "Mi", "Gi", "Ti", "Pi", "Ei", "Zi", "Yi"};
816
817 return NumberToHumanReadableString<int64_t, 1024>(n, prefixes, unit, 0, ARRAY_SIZE(prefixes) - 1);
818}
819
820// } // namespace common

Callers 1

TESTFunction · 0.85

Calls

no outgoing calls

Tested by 1

TESTFunction · 0.68