| 921 | } |
| 922 | |
| 923 | std::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 |