MCPcopy Create free account
hub / github.com/blender/cycles / string_human_readable_size

Function string_human_readable_size

src/util/string.cpp:275–292  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

273#endif /* _WIN32 */
274
275string string_human_readable_size(size_t size)
276{
277 static const char suffixes[] = "BKMGTPEZY";
278
279 const char *suffix = suffixes;
280 size_t r = 0;
281
282 while (size >= 1024) {
283 r = size % 1024;
284 size /= 1024;
285 suffix++;
286 }
287
288 if (*suffix != 'B') {
289 return string_printf("%.2f%c", double(size * 1024 + r) / 1024.0, *suffix);
290 }
291 return string_printf("%zu", size);
292}
293
294string string_human_readable_number(size_t num)
295{

Callers 15

full_reportMethod · 0.85
device_updateMethod · 0.85
init_host_memoryMethod · 0.85
generic_allocMethod · 0.85
num_concurrent_statesMethod · 0.85
OneapiDeviceMethod · 0.85
mem_allocMethod · 0.85
mem_copy_toMethod · 0.85
mem_move_to_hostMethod · 0.85
mem_copy_fromMethod · 0.85
mem_zeroMethod · 0.85

Calls 1

string_printfFunction · 0.85

Tested by

no test coverage detected