============ idStr::BestUnit ============ */
| 1633 | ============ |
| 1634 | */ |
| 1635 | int 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 | ============ |
no test coverage detected