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

Function scaled

common/script/scriptbar.cpp:32–44  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30
31namespace {
32 std::string scaled(double n, const char* unit)
33 {
34 char buf[32];
35 // One decimal below 10 of a unit, none above: "1.4 MB" is worth the
36 // digit, "947.3 MB" is noise in a figure that moves every frame.
37 if (n < 10.0) {
38 snprintf(buf, sizeof buf, "%.1f %s", n, unit);
39 }
40 else {
41 snprintf(buf, sizeof buf, "%d %s", (int)(n + 0.5), unit);
42 }
43 return buf;
44 }
45}
46
47namespace ScriptBar {

Callers 1

bytesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected