ac: add ac_build_bit_count() helper