MCPcopy Create free account
hub / github.com/BernardoGiordano/Checkpoint / bytes

Function bytes

common/script/scriptbar.cpp:48–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46
47namespace ScriptBar {
48 std::string bytes(long long n)
49 {
50 if (n < 0) {
51 n = 0;
52 }
53 if (n < 1024) {
54 return std::to_string(n) + " B";
55 }
56 if (n < 1024 * 1024) {
57 return scaled((double)n / 1024.0, "KB");
58 }
59 if (n < 1024LL * 1024 * 1024) {
60 return scaled((double)n / (1024.0 * 1024.0), "MB");
61 }
62 return scaled((double)n / (1024.0 * 1024.0 * 1024.0), "GB");
63 }
64
65 float fraction(const ScriptConsole::Layer& layer)
66 {

Callers 2

read_bodyMethod · 0.85
rightTextFunction · 0.85

Calls 2

to_stringFunction · 0.85
scaledFunction · 0.85

Tested by 1

read_bodyMethod · 0.68