MCPcopy Create free account
hub / github.com/MrNeRF/LichtFeld-Studio / format_bytes

Function format_bytes

tests/test_mcmc_memory_ops.cpp:32–41  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30}
31
32std::string format_bytes(size_t bytes) {
33 if (bytes >= 1024 * 1024 * 1024) {
34 return std::to_string(bytes / (1024 * 1024 * 1024)) + " GB";
35 } else if (bytes >= 1024 * 1024) {
36 return std::to_string(bytes / (1024 * 1024)) + " MB";
37 } else if (bytes >= 1024) {
38 return std::to_string(bytes / 1024) + " KB";
39 }
40 return std::to_string(bytes) + " bytes";
41}
42
43// =============================================================================
44// append_gather() Tests

Callers 1

TESTFunction · 0.85

Calls 1

to_stringFunction · 0.50

Tested by

no test coverage detected