| 107 | } |
| 108 | |
| 109 | std::string FormatSize(const u64 bytes) { |
| 110 | if(bytes == 0) { |
| 111 | return std::string("0") + " " + SizeSuffixes[0]; |
| 112 | } |
| 113 | |
| 114 | const auto plc = static_cast<u32>(floor(log(bytes) / log(1024))); |
| 115 | const auto byte_num = (double)(bytes / pow(1024, plc)); |
| 116 | const double rbt = ((int)(byte_num * 100.0) / 100.0); |
| 117 | std::stringstream strm; |
| 118 | strm << rbt; |
| 119 | return strm.str() + " " + SizeSuffixes[plc]; |
| 120 | } |
| 121 | |
| 122 | } |
no outgoing calls
no test coverage detected