I noticed that post PRs #459 and #1023, all instances of #define BRANCH(…) macros in vcf.c have a convert argument that is one of le_to_i8 et al, and use it to decode the VCF data structures correctly on big-endian architectures.
However I noticed that there is one instance of #define BRANCH(…) in htslib/vcf.h (in bcf_format_gt()) and it has not had such treatment. It is probably unusual for the number of alleles to go beyond BCF_BT_INT8, but if it does sure enough this failed on big-endian architectures.
This PR fixes this function by adding a convert() parameter to this last convert-less BRANCH-style macro, similar to those previously added to all the BRANCH-style macros in vcf.c and vcfutils.c. Fixes the VCF printing of records with more alleles than fits in BCF_BT_INT8.
It also adds a record with GT values >256 to test_bcf2vcf's VCF file, and regenerates the corresponding BCF file via
I noticed that post PRs #459 and #1023, all instances of
#define BRANCH(…)
macros in vcf.c have aconvert
argument that is one ofle_to_i8
et al, and use it to decode the VCF data structures correctly on big-endian architectures.However I noticed that there is one instance of
#define BRANCH(…)
in htslib/vcf.h (inbcf_format_gt()
) and it has not had such treatment. It is probably unusual for the number of alleles to go beyondBCF_BT_INT8
, but if it does sure enough this failed on big-endian architectures.This PR fixes this function by adding a
convert()
parameter to this lastconvert
-less BRANCH-style macro, similar to those previously added to all the BRANCH-style macros in vcf.c and vcfutils.c. Fixes the VCF printing of records with more alleles than fits inBCF_BT_INT8
.It also adds a record with GT values >256 to
test_bcf2vcf
's VCF file, and regenerates the corresponding BCF file viaWithout the fix, the record added to _vcffile.vcf is printed on s390x (a big-endian architecture) as: