| 810 | } |
| 811 | |
| 812 | std::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 |