@@ -878,15 +878,15 @@ static void process_gt_to_hap(convert_t *convert, bcf1_t *line, fmt_t *fmt, int
878878 ptr += fmt_gt -> n ;
879879 if ( fmt_gt -> n == 1 ) // haploid genotypes
880880 {
881- if ( ptr [0 ]== 2 ) /* 0 */
881+ if ( ( ptr [0 ] >> 1 ) == 1 ) /* 0 */
882882 {
883883 str -> s [str -> l ++ ] = '0' ; str -> s [str -> l ++ ] = ' ' ; str -> s [str -> l ++ ] = '-' ; str -> s [str -> l ++ ] = ' ' ;
884884 }
885885 else if ( ptr [0 ]== bcf_int8_missing ) /* . */
886886 {
887887 str -> s [str -> l ++ ] = '?' ; str -> s [str -> l ++ ] = ' ' ; str -> s [str -> l ++ ] = '?' ; str -> s [str -> l ++ ] = ' ' ;
888888 }
889- else if ( ptr [0 ]== 4 ) /* 1 */
889+ else if ( ( ptr [0 ] >> 1 ) == 2 ) /* 1 */
890890 {
891891 str -> s [str -> l ++ ] = '1' ; str -> s [str -> l ++ ] = ' ' ; str -> s [str -> l ++ ] = '-' ; str -> s [str -> l ++ ] = ' ' ;
892892 }
@@ -895,7 +895,7 @@ static void process_gt_to_hap(convert_t *convert, bcf1_t *line, fmt_t *fmt, int
895895 kputw (bcf_gt_allele (ptr [0 ]),str ); str -> s [str -> l ++ ] = ' ' ; str -> s [str -> l ++ ] = '-' ; str -> s [str -> l ++ ] = ' ' ;
896896 }
897897 }
898- else if ( ptr [0 ]== 2 )
898+ else if ( ( ptr [0 ] >> 1 ) == 1 )
899899 {
900900 if ( ptr [1 ]== 3 ) /* 0|0 */
901901 {
@@ -934,7 +934,7 @@ static void process_gt_to_hap(convert_t *convert, bcf1_t *line, fmt_t *fmt, int
934934 str -> s [str -> l ++ ] = '*' ; str -> s [str -> l ++ ] = ' ' ;
935935 }
936936 }
937- else if ( ptr [0 ]== 4 )
937+ else if ( ( ptr [0 ] >> 1 ) == 2 )
938938 {
939939 if ( ptr [1 ]== 3 ) /* 1|0 */
940940 {
@@ -1028,7 +1028,7 @@ static void process_gt_to_hap2(convert_t *convert, bcf1_t *line, fmt_t *fmt, int
10281028 for (i = 0 ; i < convert -> nsamples ; i ++ )
10291029 {
10301030 ptr += fmt_gt -> n ;
1031- if ( ptr [0 ]== 2 )
1031+ if ( ( ptr [0 ] >> 1 ) == 1 )
10321032 {
10331033 if ( ptr [1 ]== 3 ) /* 0|0 */
10341034 {
@@ -1067,7 +1067,7 @@ static void process_gt_to_hap2(convert_t *convert, bcf1_t *line, fmt_t *fmt, int
10671067 str -> s [str -> l ++ ] = '*' ; str -> s [str -> l ++ ] = ' ' ;
10681068 }
10691069 }
1070- else if ( ptr [0 ]== 4 )
1070+ else if ( ( ptr [0 ] >> 1 ) == 2 )
10711071 {
10721072 if ( ptr [1 ]== 3 ) /* 1|0 */
10731073 {
0 commit comments