MCPcopy Index your code
hub / github.com/Xfennec/progress / format_size

Function format_size

sizes.c:28–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26 1024ULL * 1024ULL * 1024ULL;
27
28void format_size(uint64_t size, char *result)
29{
30uint64_t multiplier;
31int i;
32
33multiplier = exbibytes;
34
35for (i = 0 ; i < DIM(sizes) ; i++, multiplier /= 1024) {
36 if (size < multiplier)
37 continue;
38 if (size % multiplier == 0)
39 sprintf(result, "%" PRIu64 " %s", size / multiplier, sizes[i]);
40 else
41 sprintf(result, "%.1f %s", (float) size / multiplier, sizes[i]);
42 return;
43}
44
45strcpy(result, "0");
46return;
47}

Callers 1

monitor_processesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected