Skip to content

Commit

Permalink
Fix Memory DIsplay (Closes #706)
Browse files Browse the repository at this point in the history
Signed-off-by: Shan Wenxiao <seanoj_noreply@yeah.net>
  • Loading branch information
PythonSmall-Q authored Aug 31, 2024
1 parent 5b27a64 commit 9870053
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions XMOJ.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,13 +322,15 @@ let SizeToStringSize = (Memory) => {
try {
if (UtilityEnabled("AddUnits")) {
if (Memory < 1024) {
return Memory + "KB";
return Memory + "B";
} else if (Memory < 1024 * 1024) {
return (Memory / 1024).toFixed(2) + "MB";
return (Memory / 1024).toFixed(2) + "KB";
} else if (Memory < 1024 * 1024 * 1024) {
return (Memory / 1024 / 1024).toFixed(2) + "GB";
return (Memory / 1024 / 1024).toFixed(2) + "MB";
} else if (Memory < 1024 * 1024 * 1024) {
return (Memory / 1024 / 1024 / 1024).toFixed(2) + "GB";
} else {
return (Memory / 1024 / 1024 / 1024).toFixed(2) + "TB";
return (Memory / 1024 / 1024 / 1024 / 1024).toFixed(2) + "TB";
}
} else {
return Memory;
Expand Down

0 comments on commit 9870053

Please sign in to comment.