(bv: &[bool])
| 221 | } |
| 222 | |
| 223 | pub fn boolvec_to_u8vec(bv: &[bool]) -> Vec<u8> { |
| 224 | let offset = if is_multiple_of_8(bv.len()) { 0 } else { 1 }; |
| 225 | let mut v = vec![0u8; divide_by_8(bv.len()) + offset]; |
| 226 | for (i, b) in bv.iter().enumerate() { |
| 227 | v[divide_by_8(i)] |= (*b as u8) << modulo_8(i); |
| 228 | } |
| 229 | v |
| 230 | } |
| 231 | |
| 232 | pub fn u8vec_to_boolvec(v: &[u8]) -> Vec<bool> { |
| 233 | let mut bv = Vec::with_capacity(multiply_by_8(v.len())); |
no test coverage detected