Added haploid support to bitwise.r