优化代码

除1024改成右移10位
This commit is contained in:
xia-chu
2024-11-29 23:07:02 +08:00
parent 67668c9f2c
commit 87b42ab492
13 changed files with 17 additions and 17 deletions

View File

@@ -284,9 +284,9 @@ static bool makeFolderMenu(const string &httpPath, const string &strFullPath, st
} else if (fileSize < 1024 * 1024) {
ss << fixed << setprecision(2) << " (" << fileSize / 1024.0 << "KB)";
} else if (fileSize < 1024 * 1024 * 1024) {
ss << fixed << setprecision(2) << " (" << fileSize / 1024 / 1024.0 << "MB)";
ss << fixed << setprecision(2) << " (" << (fileSize >> 10) / 1024.0 << "MB)";
} else {
ss << fixed << setprecision(2) << " (" << fileSize / 1024 / 1024 / 1024.0 << "GB)";
ss << fixed << setprecision(2) << " (" << (fileSize >> 20) / 1024.0 << "GB)";
}
ss << "</a></li>\r\n";
}