From 44b0a6e1825059f7edbd22b8e4b068fb6f7947a1 Mon Sep 17 00:00:00 2001 From: "Nathan T. Weeks" Date: Sun, 19 Jun 2016 06:32:01 -0700 Subject: [PATCH] Add a flexible array member to the bam1_t struct to facilitate a BAM sorting optimization. --- htslib/sam.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htslib/sam.h b/htslib/sam.h index 6b33552ff..5e1e6b6ab 100644 --- a/htslib/sam.h +++ b/htslib/sam.h @@ -163,6 +163,7 @@ typedef struct { @field l_data current length of bam1_t::data @field m_data maximum length of bam1_t::data @field data all variable-length data, concatenated; structure: qname-cigar-seq-qual-aux + @field fam_data flexible array member for contiguous-memory optimization @discussion Notes: @@ -171,6 +172,10 @@ typedef struct { on reading or from CIGAR. 3. cigar data is encoded 4 bytes per CIGAR operation. 4. seq is nybble-encoded according to bam_nt16_table. + 5. fam_data can be used to allow the variable-length data to exist in + the same contiguous memory as the rest of the bam1_t. In that case, + for compatibility the data member should point to fam_data, and + m_data set to a large value (e.g., INT_MAX). */ typedef struct { bam1_core_t core; @@ -179,6 +184,7 @@ typedef struct { #ifndef BAM_NO_ID uint64_t id; #endif + uint8_t fam_data[]; } bam1_t; /*! @function