MCPcopy Create free account
hub / github.com/GrapheneCt/NetStream / FormatViews

Method FormatViews

NetStream/source/yt_utils.cpp:478–508  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

476}
477
478void ytutils::FormatViews(wstring& res, uint32_t views, bool add)
479{
480 wchar_t buf[128];
481 uint32_t bufsize = 128;
482
483 if (views < 1000)
484 {
485 sce_paf_swprintf(buf, bufsize, L"%u views", views);
486 }
487 else if (views < 1000000)
488 {
489 sce_paf_swprintf(buf, bufsize, L"%.2gK views", views / 1000.0f);
490 }
491 else if (views < 1000000000)
492 {
493 sce_paf_swprintf(buf, bufsize, L"%.2gM views", views / 1000000.0f);
494 }
495 else
496 {
497 sce_paf_swprintf(buf, bufsize, L"%.2gB views", views / 1000000000.0f);
498 }
499
500 if (add)
501 {
502 res += buf;
503 }
504 else
505 {
506 res = buf;
507 }
508}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected