X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=bcftools%2Fbcf.h;h=3c0ab2cf8a71853a51361eca248bd0df342b423e;hb=94027d8bf194b5e62b98d8a2b240a3ab1c439b46;hp=09235740584413e1548e264424137e6784c0555f;hpb=ed5305b1d40c8d34c26221a6a897c8ebb9f4d5c6;p=samtools.git diff --git a/bcftools/bcf.h b/bcftools/bcf.h index 0923574..3c0ab2c 100644 --- a/bcftools/bcf.h +++ b/bcftools/bcf.h @@ -6,7 +6,8 @@ #include "bgzf.h" typedef struct { - int fmt, len; // len is the unit length + uint32_t fmt; + int len; // len is the unit length void *data; // derived info: fmt, len } bcf_ginfo_t; @@ -73,4 +74,15 @@ extern "C" { } #endif +static inline uint32_t bcf_str2int(const char *str, int l) +{ + int i; + uint32_t x = 0; + for (i = 0; i < l && i < 4; ++i) { + if (str[i] == 0) return x; + x = x<<8 | str[i]; + } + return x; +} + #endif