(x: f32, bits_per_value: usize, step: f32)
| 224 | |
| 225 | #[inline] |
| 226 | fn to_float_flag(x: f32, bits_per_value: usize, step: f32) -> Vec<bool> { |
| 227 | let mut n = ((x + 1.0) / step).floor() as usize; |
| 228 | let mut result = vec![false; bits_per_value]; |
| 229 | // Fill the vector with bits from the least significant to the most significant |
| 230 | for i in (0..bits_per_value).rev() { |
| 231 | result[i] = (n & 1) == 1; |
| 232 | n >>= 1; |
| 233 | } |
| 234 | |
| 235 | result |
| 236 | } |
| 237 | |
| 238 | pub fn quantize_to_u8_bits(fins: &[f32], resolution: u8) -> Vec<Vec<u8>> { |
| 239 | let bits_per_value = resolution as usize; |
no outgoing calls
no test coverage detected