implement bit-parallel algorithm