let popcount x = 
    let rec aux x acc =
      if is_zero x
      then acc
      else
        let acc = acc + (to_int (logand x one)) in
        aux (shift_right x one) acc
    in
    aux x 0