Removed PrettyBytes function

This commit is contained in:
Vladyslav Baranovskyi
2024-06-11 18:43:29 +03:00
parent 8be512e162
commit 91a44eaee0
2 changed files with 0 additions and 43 deletions

View File

@@ -74,46 +74,4 @@ namespace OpenVulkano
file.close();
return data;
}
std::string Utils::PrettyBytes(uint64_t bytes)
{
static const uint64_t TERABYTES = 1024ULL*1024*1024*1024;
static const uint64_t GIGABYTES = 1024ULL*1024*1024;
static const uint64_t MEGABYTES = 1024*1024;
static const uint64_t KILOBYTES = 1024;
int TB, GB, MB, KB;
TB = bytes / TERABYTES;
bytes -= TB * TERABYTES;
GB = bytes / GIGABYTES;
bytes -= GB * GIGABYTES;
MB = bytes / MEGABYTES;
bytes -= MB * MEGABYTES;
KB = bytes / KILOBYTES;
bytes -= KB * KILOBYTES;
std::string result;
if(TB)
{
result = std::to_string(TB) + " TB";
}
else if(GB)
{
result = std::to_string(GB) + " GB";
}
else if(MB)
{
result = std::to_string(MB) + " MB";
}
else if(KB)
{
result = std::to_string(KB) + " KB";
}
else
{
result = std::to_string(bytes) + " B";
}
return result;
}
}

View File

@@ -138,6 +138,5 @@ namespace OpenVulkano
}
static Array<char> ReadFile(const std::string& filePath, bool emptyOnMissing = false);
static std::string PrettyBytes(uint64_t bytes);
};
}