fn count_bits(data: &[usize]) -> [usize; DATA_WIDTH] {
    let mut bit_counts = [0; DATA_WIDTH];
    for reading in data {
        for i in 0..DATA_WIDTH {
            if reading & (1 << i) != 0 {
                bit_counts[i] += 1;
            }
        }
    }
    bit_counts
}
// Count number of high bits in a data set
Count number of high bits in a data set
Count number of high bits in a data set
fn count_bits(data: &[usize]) -> [usize; DATA_WIDTH] {
    let mut bit_counts = [0; DATA_WIDTH];
    for reading in data {
        for i in 0..DATA_WIDTH {
            if reading & (1 << i) != 0 {
                bit_counts[i] += 1;
            }
        }
    }
    bit_counts
}
fn count_bits ( data : & [ usize ] ) -> [ usize ; DATA_WIDTH ] { let mut bit_counts = [ 0 ; DATA_WIDTH ] ; for reading in data { for i in 0 .. DATA_WIDTH { if reading & ( 1 << i ) != 0 { bit_counts [ i ] += 1 ; } } } bit_counts }
Count number of high bits in a data set
Count number of high bits in a data set
data
&[usize]