MCPcopy Create free account
hub / github.com/XorTroll/Goldleaf / FormatSize

Function FormatSize

Goldleaf/source/fs/fs_Common.cpp:109–120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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}

Callers 7

StartCopyMethod · 0.85
StartInstallMethod · 0.85
OnFileSelectedMethod · 0.85
OnDirectorySelectedMethod · 0.85
MakeSizeInformationFunction · 0.85
StartExportMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected