MCPcopy Create free account
hub / github.com/dhewm/dhewm3 / BestUnit

Method BestUnit

neo/idlib/Str.cpp:1635–1646  ·  view source on GitHub ↗

============ idStr::BestUnit ============ */

Source from the content-addressed store, hash-verified

1633============
1634*/
1635int idStr::BestUnit( const char *format, float value, Measure_t measure ) {
1636 int unit = 1;
1637 while ( unit <= 3 && ( 1 << ( unit * 10 ) < value ) ) {
1638 unit++;
1639 }
1640 unit--;
1641 value /= 1 << ( unit * 10 );
1642 sprintf( *this, format, value );
1643 *this += " ";
1644 *this += units[ measure ][ unit ];
1645 return unit;
1646}
1647
1648/*
1649============

Callers 2

DownloadProgressBoxMethod · 0.80

Calls 1

sprintfFunction · 0.85

Tested by

no test coverage detected