1 const FP_ILOGBNAN: i32 = -1 - 0x7fffffff; 2 const FP_ILOGB0: i32 = FP_ILOGBNAN; 3 ilogbf(x: f32) -> i324pub fn ilogbf(x: f32) -> i32 { 5 let mut i = x.to_bits(); 6 let e = ((i >> 23) & 0xff) as i32; 7 8 if e == 0 { 9 i <<= 9; 10 if i == 0 { 11 force_eval!(0.0 / 0.0); 12 return FP_ILOGB0; 13 } 14 /* subnormal x */ 15 let mut e = -0x7f; 16 while (i >> 31) == 0 { 17 e -= 1; 18 i <<= 1; 19 } 20 e 21 } else if e == 0xff { 22 force_eval!(0.0 / 0.0); 23 if (i << 9) != 0 { 24 FP_ILOGBNAN 25 } else { 26 i32::max_value() 27 } 28 } else { 29 e - 0x7f 30 } 31 } 32