fn order_of_magnitude(byte_size: u64) -> usize {
        let mut order_of_magnitude = 0;
        let mut remaining_precision = byte_size as f64;
        while remaining_precision >= 1.0 {
            remaining_precision /= 1024.0;
            order_of_magnitude += 1;
        }
        if order_of_magnitude > 0 {
            order_of_magnitude -= 1;
        }
        order_of_magnitude.min(Self::UNITS.len())
    }
/// Compute the order of magnitude in units of 1024.
///
/// This could probably be improved with some logarithms (division in a
/// loop, I'm looking at you!), but the while loop works just fine.
Compute the order of magnitude in units of 1024.
This could probably be improved with some logarithms (division in a
loop, I'm looking at you!), but the while loop works just fine.
Compute the order of magnitude in units of 1024 . This could probably be improved with some logarithms ( division in a loop I ' m looking at you! ) but the while loop works just fine .
fn order_of_magnitude(byte_size: u64) -> usize {
        let mut order_of_magnitude = 0;
        let mut remaining_precision = byte_size as f64;
        while remaining_precision >= 1.0 {
            remaining_precision /= 1024.0;
            order_of_magnitude += 1;
        }
        if order_of_magnitude > 0 {
            order_of_magnitude -= 1;
        }
        order_of_magnitude.min(Self::UNITS.len())
    }
fn order_of_magnitude ( byte_size : u64 ) -> usize { let mut order_of_magnitude = 0 ; let mut remaining_precision = byte_size as f64 ; while remaining_precision >= 1.0 { remaining_precision /= 1024.0 ; order_of_magnitude += 1 ; } if order_of_magnitude > 0 { order_of_magnitude -= 1 ; } order_of_magnitude . min ( Self :: UNITS . len ( ) ) }
Compute the order of magnitude in units of 1024.
Compute the order of magnitude in units of 1024 .
byte_size
u64