]> git.donarmstrong.com Git - samtools.git/blobdiff - bcftools/bcf.h
* improved kstring (added kstrtok)
[samtools.git] / bcftools / bcf.h
index 09235740584413e1548e264424137e6784c0555f..3c0ab2cf8a71853a51361eca248bd0df342b423e 100644 (file)
@@ -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